Re: Pep 3105: the end of print?
- From: Peter Mayne <Peter.Mayne@xxxxxx>
- Date: Thu, 22 Feb 2007 16:29:17 +1100
Steven D'Aprano wrote:
On Tue, 20 Feb 2007 00:44:24 +0000, Peter mayne wrote:
Steven D'Aprano wrote:If Python 3 dropped the printIs there any reason why official_print_function isn't sys.stdout.write?
statement and replaced it with official_print_function(), how would that
help you in your goal to have a single code base that will run on both
Python 2.3 and Python 3, while still using print?
Why would you want a convenience function like print to take one import,
three look-ups and 16 characters instead of always available, one look-up
and five characters?
Because it's compatible between Python 2.x and Python 3.x? :-)
Because without print as a keyword, I can say "print = sys.stdout.write"
and still have (some) convenience? (Albeit still one import and one
lookup, though given the probable time taken to do the I/O, why worry
about the lookup?) Or, if your editor has an abbreviation facility like
Eclipse, you can type sys.stdout.write with less than 5 keystrokes.
I can't remember the last time I used print in actual code (apart from short-lived debugging lines), so I'm bewildered as to why print seems to be so important.
print is important for the convenience, for short-lived debugging, and for
use in the interactive interpreter.
Why use print in the interactive interpreter? Just type the expression.
Hmm, I was expecting that that wouldn't always work, but:
>>> x=3
>>> if x==3: x
....
3
>>> for i in range(x):
.... i
....
0
1
2
PJDM
.
- Follow-Ups:
- Re: Pep 3105: the end of print?
- From: Steven D'Aprano
- Re: Pep 3105: the end of print?
- References:
- Pep 3105: the end of print?
- From: Edward K Ream
- Re: Pep 3105: the end of print?
- From: Steven Bethard
- Re: Pep 3105: the end of print?
- From: Edward K Ream
- Re: Pep 3105: the end of print?
- From: Steven Bethard
- Re: Pep 3105: the end of print?
- From: Edward K Ream
- Re: Pep 3105: the end of print?
- From: Fuzzyman
- Re: Pep 3105: the end of print?
- From: Edward K Ream
- Re: Pep 3105: the end of print?
- From: Fuzzyman
- Re: Pep 3105: the end of print?
- From: Edward K Ream
- Re: Pep 3105: the end of print?
- From: Steven D'Aprano
- Re: Pep 3105: the end of print?
- From: Edward K Ream
- Re: Pep 3105: the end of print?
- From: Steven D'Aprano
- Re: Pep 3105: the end of print?
- From: Peter mayne
- Re: Pep 3105: the end of print?
- From: Steven D'Aprano
- Pep 3105: the end of print?
- Prev by Date: Re: Question about classes and possible closure.
- Next by Date: Re: Question about classes and possible closure.
- Previous by thread: Re: Pep 3105: the end of print?
- Next by thread: Re: Pep 3105: the end of print?
- Index(es):
Relevant Pages
|
Loading