Fredrik Lundh wrote: > > Vladimir wrote: > > I understand that you want me to think this way. But that's not my > > intuitive thinking. I would have written your example like this: > > > > def func(file=sys.stdout): > > print >> file, args > > > > This is a clearer, compared to None which is not a file. This is not clearer. Instead, it is presetting a parameter with a mutable object - bad practice! > Sigh. You code doesn't work. Quoting the PEP, from the section > that discusses why passing None is the same thing as passing no > file at all: > > "Note: defaulting the file argument to sys.stdout at compile time > is wrong, because it doesn't work right when the caller assigns to > sys.stdout and then uses tables() without specifying the file." > > I was sceptical at first, but the more I see of your counter-arguments, > the more I support Guido here. As he pointed out, None usually means > "pretend I didn't pass this argument" in Python. No difference here. > > +1 on keeping print as it's implemented (None means default). > -1 on making None behave like a NullFile. Seconded! ciao - chris -- Christian Tismer :^) <mailto:tismer@appliedbiometrics.com> Applied Biometrics GmbH : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 14163 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4