Using python 3 for scripting?

T

Timo Myyrä

Hi,

I'll have to do some scripting in the near future and I was
thinking on using the Python for it. I would like to know which
version of Python to use? Is the Python 3 ready for use or should
I stick with older releases?

Timo
 
R

R. David Murray

Hi,

I'll have to do some scripting in the near future and I was
thinking on using the Python for it. I would like to know which
version of Python to use? Is the Python 3 ready for use or should
I stick with older releases?

If you are using it for scripting that doesn't need anything not included
in the standard library (which is true of a lot of scripting tasks), then
I would say Python 3 is very ready. You'll have some I/O performance
issues if do lots of I/O with 3.0, but 3.1 is almost out the door and
that fixes the I/O performance issue.
 
C

Chris Rebert

2009/3/22 Timo Myyrä said:
Hi,

I'll have to do some scripting in the near future and I was thinking on using the Python for it. I would like to know which version of Python to use? Is the Python 3 ready for use or should I stick with older releases?

2.6.1, the latest non-3.x release is probably best. Most libraries
haven't been ported to 3.x yet, so Python 3 has yet to become
widespread.

Cheers,
Chris
 
T

Timo Myyrä

Ok, I think I'll stick with the 2.6 then. I recall it gave
warnings about things that are deprecated in 3.0 so it will make
porting the scripts to 3.0 easier.

I might try 3.0 once I know what kind of scripts are needed.
 
R

R. David Murray

Ok, I think I'll stick with the 2.6 then. I recall it gave
warnings about things that are deprecated in 3.0 so it will make
porting the scripts to 3.0 easier.

I might try 3.0 once I know what kind of scripts are needed.

In case you don't recall, running your scripts under 2.6 with -3 will
give you useful info.

Someone else recommended 2.5, and that is a valid recommendation if you
are planning to ship your scripts off to a variety of target hosts.
Some linux distributions are still shipping with 2.5 as standard.
You'll run into some systems that haven't been updated from 2.4 yet,
for that matter.

But if this is for your own local use, personally I'd do (will be doing
new stuff) everything possible in 3, and only dropping back to 2.6 when
I have to. Unfortunately in some cases I _do_ have to support a number
of servers that are still running 2.5 :(
 
T

Timo Myyrä

I might get summer job in doing some 2nd tier support and doing
some scripting besides that in Solaris environment. I gotta see
what kind of scripts are needed but I'd guess the 2.6 would be the
safest option.

Timo
 
P

Paul Watson

Ok, I think I'll stick with the 2.6 then. I recall it gave
warnings about things that are deprecated in 3.0 so it will make
porting the scripts to 3.0 easier.

I might try 3.0 once I know what kind of scripts are needed.

Yes. Develop your code using 2.6, then use the '2to3' utility to port
it to 3.0.

As others have mentioned, there are -many- third party packages which
are not available for 3.0 yet.
 
A

afriere

I might get summer job in doing some 2nd tier support and doing
some scripting besides that in Solaris environment. I gotta see
what kind of scripts are needed but I'd guess the 2.6 would be the
safest option.

Timo

Solaris? In that case you'd better stick to python 1.6!

Only joking, I work in a Solaris shop and the admin has now upgraded
python to 2.5 on most of the servers ...
 
T

Timo Myyrä

Not too keen on working with Solaris either. Did some small
configuration last time I worked there and it was all a mess. I'm
trying to convince them to switch to OpenBSD :)

Timo
 
A

Alan G Isaac

2.6.1, the latest non-3.x release is probably best. Most libraries
haven't been ported to 3.x yet, so Python 3 has yet to become
widespread.


This seems slightly optimistic to me.
Until a week ago, there was not a NumPy release for 2.6.
There is still not a SciPy release for 2.6.
Most dismaying, the SimpleParse guys need a little
help compiling SimpleParse for 2.6 and have not yet
gotten that help. (Is anyone listening?)

So 2.5.4 is still perhaps the safest bet, even
though it is more awkward for writing code close
to Python 3 syntax.

Alan Isaac
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top