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


Groups > comp.lang.python > #41704

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

Date 2013-03-22 15:11 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: Change in Python 3.3 with the treatment of sys.argv
References <kiik4o$s8b$1@theodyn.ncf.ca>
Newsgroups comp.lang.python
Message-ID <mailman.3618.1363990906.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 03/22/2013 02:57 PM, 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)

First, this is what I get with 3.3:

Python 3.3.0 (default, Sep 29 2012, 17:14:58)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
--> import sys
--> sys.argv
['']
--> sys.argv[1:] = ('this is a test!', )
--> sys.argv
['', 'this is a test!']
--> ' '.join(sys.argv[1:])
'this is a test!'


Second, your code doesn't show being joined by an underscore.

--
~Ethan~

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