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


Groups > comp.lang.python > #41705

Re: Change in Python 3.3 with the treatment of sys.argv

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.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.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'modify': 0.05; 'result,': 0.05; '__name__': 0.07; 'main()': 0.07; 'trailing': 0.07; 'python': 0.09; "'\\n')": 0.09; "'w')": 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'script,': 0.09; 'sep': 0.09; 'def': 0.10; 'slightly': 0.15; "'__main__':": 0.16; '2.7.3': 0.16; '3.2,': 0.16; '3.3,': 0.16; 'comma': 0.16; 'main():': 0.16; 'pentium': 0.16; 'received:80.91.229.3': 0.16; 'received:dip.t-dialin.net': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-dialin.net': 0.16; 'skip:i 120': 0.16; 'subject:3.3': 0.16; 'subject:Change': 0.16; 'string': 0.17; 'wrote:': 0.17; '>>>': 0.18; 'input': 0.18; 'versions': 0.20; 'bit': 0.21; 'statement': 0.23; 'random': 0.24; 'machine': 0.24; 'header:User-Agent:1': 0.26; 'disk': 0.27; 'forgot': 0.27; 'header:X-Complaints-To:1': 0.28; 'skip:( 20': 0.28; 'initial': 0.28; 'run': 0.28; 'cpu': 0.29; 'skip:i 60': 0.29; 'code': 0.31; "skip:' 20": 0.32; 'extract': 0.33; 'ram': 0.33; 'to:addr:python- list': 0.33; 'text': 0.34; 'received:org': 0.36; 'compare': 0.36; 'subject:with': 0.36; 'test': 0.36; 'skip:p 20': 0.36; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'some': 0.38; 'delete': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'free': 0.61; 'between': 0.63; 'url:%20': 0.63; 'different': 0.63; 'url:%1': 0.68; 'increasing': 0.75
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: Change in Python 3.3 with the treatment of sys.argv
Date Fri, 22 Mar 2013 23:33:13 +0100
Organization None
References <kiik4o$s8b$1@theodyn.ncf.ca>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p5084b5c7.dip.t-dialin.net
User-Agent KNode/4.7.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.3619.1363991602.2939.python-list@python.org> (permalink)
Lines 52
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1363991602 news.xs4all.nl 6952 [2001:888:2000:d::a6]:41314
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41705

Show key headers only | View raw


Colin J. Williams wrote:

> Below is an extract from some code to run on Python 2.7.3, 3.2.3 and
> 3.3.0 to compare speeds, both between versions and machines:
> 
> if __name__ == '__main__':
>      # Text string for initial test - Modify for your own machine or
>      # delete it and and answer the input statement with your own machine
>      # characteristics.
>      sys.argv[1:]= ('Intel Pentium D CPU 3.0GHz 1.99 GB of RAM 221GB
> Disk Free space', )
>      main()
> 
> 
> def main():
>      if len(sys.argv) > 1:
>          idMachine= ' '.join(sys.argv[1:])
>      ...
>      oFile= open('FP' + now + '.log', 'w')
>      oFile.writelines(idM + '\n' + sys.version + '\n')
> 
> For 2.7, the result is:
> Intel_Pentium_D_CPU_3.0GHz_1.99_GB_of_RAM_221GB_Disk_Free_space
> 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
> 
> for 3.2, the result is:
> Intel_Pentium_D_CPU_3.0GHz_1.99_GB_of_RAM_221GB_Disk_Free_space
> 3.2.3 (default, Apr 11 2012, 07:15:24) [MSC v.1500 32 bit (Intel)]
> 
> For 3.3, the result is:
> 
I_n_t_e_l___P_e_n_t_i_u_m___D___C_P_U___3_._0_G_H_z___1_._9_9___G_B___o_f___R_A_M___2_2_1_G_B___D_i_s_k___F_r_e_e___s_p_a_c_e
> 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit
> (Intel)]
> 
> The full test result, for random matrices of increasing order is
> available
> here(http://web.ncf.ca/cjw/FP%20Summary%20over%20273-323-330.txt)

You may have run Python 3.3 with a slightly different script, one where you 
forgot a trailing comma:

>>> argv = ["foo"]
>>> argv[1:] = ("bar",) # with comma
>>> print("-".join(argv[1:]))
bar
>>> argv = ["foo"]
>>> argv[1:] = ("bar") # without comma
>>> print("-".join(argv[1:]))
b-a-r

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


Thread

Change in Python 3.3 with the treatment of sys.argv "Colin J. Williams" <cjw@ncf.ca> - 2013-03-22 17:57 -0400
  Re: Change in Python 3.3 with the treatment of sys.argv Chris Angelico <rosuav@gmail.com> - 2013-03-23 09:13 +1100
  Re: Change in Python 3.3 with the treatment of sys.argv Ethan Furman <ethan@stoneleaf.us> - 2013-03-22 15:11 -0700
    Re: Change in Python 3.3 with the treatment of sys.argv "Colin J. Williams" <cjw@ncf.ca> - 2013-03-23 06:43 -0400
      Re: Change in Python 3.3 with the treatment of sys.argv Peter Otten <__peter__@web.de> - 2013-03-23 11:59 +0100
    Re: Change in Python 3.3 with the treatment of sys.argv "Colin J. Williams" <cjw@ncf.ca> - 2013-03-23 06:43 -0400
    Re: Change in Python 3.3 with the treatment of sys.argv "Colin J. Williams" <cjw@ncf.ca> - 2013-03-23 08:27 -0400
      Re: Change in Python 3.3 with the treatment of sys.argv Chris Angelico <rosuav@gmail.com> - 2013-03-23 23:34 +1100
    Re: Change in Python 3.3 with the treatment of sys.argv "Colin J. Williams" <cjw@ncf.ca> - 2013-03-23 08:27 -0400
  Re: Change in Python 3.3 with the treatment of sys.argv Peter Otten <__peter__@web.de> - 2013-03-22 23:33 +0100
  Re: Change in Python 3.3 with the treatment of sys.argv Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-22 23:45 +0000

csiph-web