Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22192

Re: Is there any difference between print 3 and print '3' in Python ?

Newsgroups comp.lang.python
Date 2012-03-26 07:28 -0700
References <5128580.32.1332762326119.JavaMail.geo-discussion-forums@pbom7> <mailman.995.1332763895.3037.python-list@python.org>
Subject Re: Is there any difference between print 3 and print '3' in Python ?
From redstone-cold@163.com
Message-ID <mailman.1004.1332772679.3037.python-list@python.org> (permalink)

Show all headers | View raw


在 2012年3月26日星期一UTC+8下午8时11分03秒,Dave Angel写道:
> On 03/26/2012 07:45 AM, redstone-cold@163.com wrote:
> > I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ?
> 
> This is a non-question.  The input is the same, the output is the same, 
> what else matters?
> 
> On the other hand, if you want to dig deeper, there are lots of differences:
> 
> 1) the former has a shorter source file
> 2) different C code is utilized inside the interpreter
> 3) different machine code executes
> 4) the temporary objects created have different id's and types
> 5) different execution times (by a trivial amount)
> 6) it takes different keystrokes to edit the two source files once you 
> want to make it do something useful
> 7) the processor works a little harder on one than the other, possibly 
> resulting in a different power consumption
> 8) different byte code is produced
> 
> Or you could be asking about Python version 3, in which case
> 1) the syntax error message points to a different character
> 
> -- 
> 
> DaveA



在 2012年3月26日星期一UTC+8下午8时11分03秒,Dave Angel写道:
> On 03/26/2012 07:45 AM, redstone-cold@163.com wrote:
> > I know the print statement produces the same result when both of these two instructions are executed ,I just want to know Is there any difference between print 3 and print '3' in Python ?
> 
> This is a non-question.  The input is the same, the output is the same, 
> what else matters?
> 
> On the other hand, if you want to dig deeper, there are lots of differences:
> 
> 1) the former has a shorter source file
> 2) different C code is utilized inside the interpreter
> 3) different machine code executes
> 4) the temporary objects created have different id's and types
> 5) different execution times (by a trivial amount)
> 6) it takes different keystrokes to edit the two source files once you 
> want to make it do something useful
> 7) the processor works a little harder on one than the other, possibly 
> resulting in a different power consumption
> 8) different byte code is produced
> 
> Or you could be asking about Python version 3, in which case
> 1) the syntax error message points to a different character
> 
> -- 
> 
> DaveA

Oh ,God !  I think this is what I really want to know ,thank you very much !

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Is there any difference between print 3 and print '3' in Python ? redstone-cold@163.com - 2012-03-26 04:45 -0700
  Re: Is there any difference between print 3 and print '3' in Python ? Chris Angelico <rosuav@gmail.com> - 2012-03-26 23:01 +1100
  Re: Is there any difference between print 3 and print '3' in Python ? Kiuhnm <kiuhnm03.4t.yahoo.it> - 2012-03-26 14:07 +0200
  Re: Is there any difference between print 3 and print '3' in Python ? Robert Kern <robert.kern@gmail.com> - 2012-03-26 13:10 +0100
  Re: Is there any difference between print 3 and print '3' in Python ? Dave Angel <d@davea.name> - 2012-03-26 08:11 -0400
    Re: Is there any difference between print 3 and print '3' in Python ? redstone-cold@163.com - 2012-03-26 07:28 -0700
      Re: Is there any difference between print 3 and print '3' in Python ? Stefan Behnel <stefan_ml@behnel.de> - 2012-03-26 17:03 +0200
    Re: Is there any difference between print 3 and print '3' in Python ? redstone-cold@163.com - 2012-03-26 07:28 -0700
    Re: Is there any difference between print 3 and print '3' in Python ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-27 03:43 +0000
      Re: Is there any difference between print 3 and print '3' in Python ? rusi <rustompmody@gmail.com> - 2012-03-26 22:00 -0700
  Re: Is there any difference between print 3 and print '3' in Python ? Terry Reedy <tjreedy@udel.edu> - 2012-03-26 11:45 -0400
  Re: Is there any difference between print 3 and print '3' in Python ? "J. Cliff Dyer" <jcd@sdf.lonestar.org> - 2012-03-26 13:06 -0400
  Re: Is there any difference between print 3 and print '3' in Python ? Peter Otten <__peter__@web.de> - 2012-03-26 19:20 +0200

csiph-web