Python rocks
Josiah Carlson
josiah.carlson at sbcglobal.net
Sat Jun 2 16:32:06 EDT 2007
Mark Carter wrote:
> Not that I'm particularly knowledgeable about language design issues,
> but maybe closures and slightly different scoping rules would be nice.
Python has had closures for years. What kind of scoping did you desire?
> A
> pitfall of Python is knowing whether an operation is destructive or not.
If it returns None, it probably changes the content of an object.
> I guess if it was a purely functional language, that particular question
> wouldn't arise.
You can certainly do your programming in a functional style with Python.
List comprehensions and generator expressions are very good for this
kind of thing.
> Oh, and when I read a line, I'd like it to get rid
> of the trailing line-ending characters.
Refuse the temptation to guess. As many people want to keep the
newlines as not (it disambiguates the case of end of file and blank
line), and it is a simple thing to deal with: line.rstrip('\r\n') .
- Josiah
More information about the Python-list
mailing list