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


Groups > comp.lang.python > #22194

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

Path csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.014
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'interpreter': 0.07; "subject:' ": 0.07; 'subject:Python': 0.07; 'python': 0.11; 'print': 0.15; 'dig': 0.16; 'executed': 0.16; 'executes': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'received:188.174': 0.16; 'received:80.91': 0.16; 'received:80.91.229': 0.16; 'received:gmane.org': 0.16; 'received:list': 0.16; 'received:m-online.net': 0.16; 'subject:between': 0.16; 'output': 0.18; 'resulting': 0.18; 'wrote:': 0.21; 'processor': 0.22; 'produces': 0.22; 'statement': 0.22; 'header:In-Reply-To:1': 0.22; 'header:User-Agent:1': 0.23; 'possibly': 0.23; 'syntax': 0.23; '>>>': 0.24; 'input': 0.24; 'error': 0.25; 'stefan': 0.27; '(by': 0.29; 'code': 0.29; 'file': 0.29; 'asking': 0.29; 'machine': 0.29; 'character': 0.30; 'points': 0.30; 'source': 0.31; 'produced': 0.32; 'byte': 0.33; 'could': 0.34; 'two': 0.35; 'there': 0.35; 'version': 0.36; 'header:X-Complaints-To:1': 0.36; 'list': 0.37; 'something': 0.38; 'received:org': 0.38; 'to:addr:python-list': 0.39; 'think': 0.40; 'to:addr:python.org': 0.40; 'received:188': 0.61; 'skip:n 10': 0.62; 'above.': 0.63; 'between': 0.64; 'inside': 0.65; 'different': 0.65; 'temporary': 0.66; 'times': 0.66; "'3'": 0.84; 'skip:2 50': 0.84; 'subject:there': 0.84; 'power': 0.87; 'same,': 0.91; 'hand,': 0.96; 'email addr:163.com': 0.97
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Stefan Behnel <stefan_ml@behnel.de>
Subject Re: Is there any difference between print 3 and print '3' in Python ?
Date Mon, 26 Mar 2012 17:03:21 +0200
References <5128580.32.1332762326119.JavaMail.geo-discussion-forums@pbom7> <mailman.995.1332763895.3037.python-list@python.org> <9916924.0.1332772105737.JavaMail.geo-discussion-forums@pbbls7>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host host-188-174-218-242.customer.m-online.net
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120310 Thunderbird/11.0
In-Reply-To <9916924.0.1332772105737.JavaMail.geo-discussion-forums@pbbls7>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1006.1332774214.3037.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1332774214 news.xs4all.nl 6904 [2001:888:2000:d::a6]:60423
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:22194

Show key headers only | View raw


redstone-cold@163.com, 26.03.2012 16:28:
> 在 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
> 
> Oh ,God !

I don't think she takes any responsibility for the list above.

Stefan

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