Re: Definite menu code rewrite
On Jul 21, Hamish Moffatt wrote:
> On Sat, Jul 20, 2002 at 04:40:01PM -0500, Chris Lawrence wrote:
> > Python (2.1) is standard as of woody. Python 2.2 or 2.3 will be
> > standard for woody+1, since that's what reportbug 2 needs anyway (I'll
> > probably be writing against 2.2).
>
> New interpreter versions require you to rewrite your code?
> I thought only Tcl was that bad.
No, but using the newer Python 2.2/2.3 features makes reportbug
cleaner and easier to maintain. For example, in 2.2 to test whether a
key is in a dictionary (hash):
if 'key' in dict:
whereas for 2.1 and below:
if dict.has_key('key'):
To cat a file in 2.2 (using the iterator for file objects):
for line in open('filename'):
print line,
whereas for 2.1 and below:
for line in open('filename').readlines():
print line,
Etc, etc, ad nauseum.
Chris
--
Chris Lawrence <cnlawren@olemiss.edu> - http://www.lordsutch.com/chris/
Instructor and Ph.D. Candidate, Political Science, Univ. of Mississippi
208 Deupree Hall - 662-915-5765
--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: