Implementing file reading in C/Python

Steve Holden steve at holdenweb.com
Fri Jan 9 11:45:29 CET 2009


Steven D'Aprano wrote:
> On Fri, 09 Jan 2009 19:33:53 +1000, James Mills wrote:
> 
>> On Fri, Jan 9, 2009 at 7:15 PM, Marc 'BlackJack' Rintsch
>> <bj_666 at gmx.net> wrote:
>>>> print("Filesize       : %d" % (filesize)) print("Image size     :
>>>> %dx%d" % (width, height)) print("Bytes per Pixel: %d" % (blocksize))
>>> Why parentheses around ``print``\s "argument"?  In Python <3 ``print``
>>> is a statement and not a function.
>> Not true as of 2.6+ and 3.0+
>>
>> print is now a function.
> 
> 
> Not so. print is still a statement in 2.6.
> 
> $ python2.6
> Python 2.6.1 (r261:67515, Dec 24 2008, 00:33:13)
> [GCC 4.1.2 20070502 (Red Hat 4.1.2-12)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> print 23
> 23
> 
C:\Users\sholden>\python26\python
Python 2.6 (r26:66721, Oct  2 2008, 11:35:03) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print
<built-in function print>
>>>

OK, I confess I missed out

>>> from __future__ import print_function

regards
 Steve
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list