Re: [Tutor] Static Variable in Functions

2011-03-15 Thread Tom Zych
Steven D'Aprano wrote: > Most of the common built-in Python objects are immutable: > ... > while a few are mutable: > > lists > dicts > sets Also, bytearrays. -- Tom Zych / freethin...@pobox.com ___ Tutor maillist - Tutor

Re: [Tutor] atr in dir Vs. hasattr

2011-03-16 Thread Tom Zych
OTOH, I got True in 3.1.1. As the docs say, detailed behavior may change across releases. I suppose there must be some reliable way to get a list of *all* an object's attributes, but I don't see it. -- Tom Zych / freethin...@pobox.com ___ T

Re: [Tutor] Checksum program

2011-03-23 Thread Tom Zych
ote what type of object it is. Your loop will work but it's not Pythonic - you can iterate over a sequence directly: for i in message: # i = a character (string of length 1) from message print "Processing", i -- Tom Zych / freethin...@pobox.com "Because if

Re: [Tutor] Recursively flatten the list

2011-03-24 Thread Tom Zych
ing code would be more readable. Regarding this line: if type(i) == type([]): This also works: if type(i) == list: But this is better: if isinstance(i, list): isinstance(obj, class) means "is obj an instance of class or a subtype of class", so it's more general. Do

Re: [Tutor] if os.path.exists() or if not os.path.exists()?

2011-03-24 Thread Tom Zych
log.write('No existe el archivo ' +shx + "\n") > if os.path.exists(dbf): > print 'El archivo ' +dbf +' existe' > log.write('No existe el archivo ' +dbf + "\n") I don't know about the rest, but you