Gentoo Archives: gentoo-user

From: Marc Joliet <marcec@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] new machine : suddenly Python 3 appears
Date: Mon, 17 Sep 2012 20:20:55
Message-Id: 20120917221758.4ed94a2e@marcec.hunte.us
In Reply to: Re: [gentoo-user] new machine : suddenly Python 3 appears by Philip Webb
1 Am Mon, 17 Sep 2012 14:45:41 -0400
2 schrieb Philip Webb <purslow@××××××××.net>:
3
4 > 120917 David W Noon wrote:
5 > > On Mon, 17 Sep 2012 13:14:27 -0400, Philip Webb wrote re Python 2/3 :
6 > >> print ' ',eval(expression)
7 > > The above line uses obsolete syntax. Try using
8 > > #!/usr/bin/python2 -3
9 > > for your hash-bang line on all your old Python scripts.
10 >
11 > Well, thanks for the info -- which is what I suspected -- ,
12 > but just what is the correct Python3 syntax for that simple print line ?
13 > This is my only Python script, which I got from somewhere long forgotten,
14 > & I generally don't have a need to do Python programming.
15
16 print ' ',eval(expression)
17
18 becomes
19
20 print(' ',eval(expression))
21
22 > While this subject is open, can anyone tell me
23 > how to get Python3 started from CLI automatically to load the math item ?
24 > -- ie to do 'from math import *' without my having to type it ?
25 > That would make it possible to use 'python' instead of my script,
26 > which would then allow me to use variables, sometimes an advantage.
27
28 Sorry, I don't know, and skimming through the python man page didn't turn up
29 anything except "-m <module>", which executes a python module as a
30 script. Perhaps someone else knows a possibility.
31
32 Apart from that, I don't really understand what you want to do from there.
33 Could you maybe explain in more detail?
34
35 HTH
36 --
37 Marc Joliet
38 --
39 "People who think they know everything really annoy those of us who know we
40 don't" - Bjarne Stroustrup

Attachments

File name MIME type
signature.asc application/pgp-signature