Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-29 Thread Tim Golden
Chris Hengge wrote:
> I hope this is related enough for this thread, but I'm curious why 
> people didn't seem to unanimously jump into 2.5 upon release. Python 
> seems very good about holding its backward compatibility vs some other 
> languages I've dealt with like C# that seems to require applications 
> rewritten with every patch. Was there just nothing that "grand" about 
> the new version? I've personally held back just because most of the 
> documentation I've come across is for 2.4, and until I get a firmer feel 
> for the language I'm trying to not mix things up.

Speaking for myself as a Win32 user, you generally have to
recompile / download compiled binaries for any new release
of Python. I have downloaded 2.5 and there certainly are
things which interest me, but I won't shift to using it
for mainstream work until all the modules I need are
available at 2.5. (For the most part I could compile
them myself with mingw32, but you start to realise just
how much work is involved when you need to download
libs and headers for all the externals. So I'm lazy and
wait for the project maintainer to supply...).

Also I'm faintly chary of starting to use some whizz-bang
new feature (like the with block) which is incompatible
with 2.4 and then trying to run the code on my webserver
where I've only got 2.4!

TJG
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] subprocess.Popen.communicate()[]

2006-12-29 Thread Alan Gauld

"Isaac" <[EMAIL PROTECTED]> wrote 
> Without communicate()[0] the screen is blank and no prompt.

Ah. I see.
OK, Thanks for clarifying that.

I should have tried both versions, I only checked that my version 
did, in fact, clear the screen, I didn't check how yours 
behaved - naughty!

Alan G.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in alist, using a list comp)

2006-12-29 Thread Alan Gauld
"Chris Hengge" <[EMAIL PROTECTED]> wrote 
>...I'm curious why people didn't seem to unanimously jump 
> into 2.5 upon release. 

I can't speak for anyone else, but personally I never load the 
first version of any software. I only upgrade when I find a 
feature I actually know I need and after I'm confident that 
the bugs have been squashed. 

This applies to all software not just Python.
I'm currently running FrameMaker 5.5 (latest vesion is 7!) 
and MS Word 97/2002(latest version???). Most of my Oracle 
databases are still at version 8. On my servers at work 
Python is still at v2.2. We only upgraded our Win2000 
boxes to XP after SP2 came out (6 months after to be 
accurate!)

Chasing the latest release is a time consuming sport that 
isn't worth doing unless it actually delivers some real benefit
IMHO. Which is why I asked what the real benefits of 2.5 are?
>From Wes' list I only see tertiary operators and try/except/finally
as useful to me - and both are just minor style fixes. So I 
doubt if I'll move from 2.3(MacOS)/2.4(XP and Linux) for a 
while yet - at least not until the ActiveState version comes 
out for XP.

One thing I will be investigating is the WSGI stuff, I've come 
across mentions of that several times now, and know 
nothing about it.

Alan G.



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-29 Thread Kent Johnson
wesley chun wrote:
> below is a quick summary of the 2.5 highlights.  of these, i like/use
> the following:
> 1, 2, 4, 5, 6, 7, (8), 9a, 9b. 
> 
> 7) Enhanced Generator Features (PEP 342) -- now you can "talk-back" to
> a generator, meaning you can send data into it as you resume it...
> .next() sends None, .send(obj) sends obj, .throw(exc) throws exception
> exc

Are you using this? I would be interested in finding out how. This seems 
like a feature that allows Python to be used in a new way, but I have 
not yet seen any real applications of it.

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] XML-RPC data transfers.

2006-12-29 Thread Lee Harr
>http://www.velocityreviews.com/forums/t343990-xmlrpc-send-file.html
>
>Using this example I get error's about 'expected binary .read(), but got
>instance instead.


I assume you are using this ...

>d = xmlrpclib.Binary(open("C:\\somefile.exe").read())


Are you using windows?

I think you would need to pass the binary flag to open ...

imagedata = open(filename, 'rb').read()



It's probably a good idea to use the binary flag if you are expecting
binary data just in case it gets ported somewhere else later.


>I've just been using xmlrpclib and simplexmlrpcserver for this, but I'm
>wondering if I should perhaps use twisted instead.

I've used xml-rpc to send image data before. It worked.

_
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.com/

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-29 Thread Andreas Kostyrka
* Chris Hengge <[EMAIL PROTECTED]> [061229 02:25]:
>I hope this is related enough for this thread, but I'm curious why people
>didn't seem to unanimously jump into 2.5 upon release. Python seems very
>good about holding its backward compatibility vs some other languages I've
>dealt with like C# that seems to require applications rewritten with every
>patch. Was there just nothing that "grand" about the new version? I've
>personally held back just because most of the documentation I've come
>across is for 2.4, and until I get a firmer feel for the language I'm
>trying to not mix things up.

I'd say it's a deployment issue. So basically people with deployement
issues keep back. People with small user populations are already
upgrading to 2.5.

Andreas
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-29 Thread Chris Calloway
Chris Hengge wrote:
> I hope this is related enough for this thread, but I'm curious why 
> people didn't seem to unanimously jump into 2.5 upon release.

If I'm driving a 2006 model car, I don't rush right out and trade for a 
2007 model just because they are available.

There's cost and effort involved with changing versions. Not the least 
is having to retest all your existing applications.

Generators now have a different syntax, so some applications would need 
some updating in order to take advantage of 2.5.

The new "with" statement is very cool, though.

> I've personally held back just because most of the 
> documentation I've come across is for 2.4,

100% of this is Python 2.5 documentation:

http://docs.python.org/

Very little of it had to change from the last version.

-- 
Sincerely,

Chris Calloway
http://www.seacoos.org
office: 332 Chapman Hall   phone: (919) 962-4323
mail: Campus Box #3300, UNC-CH, Chapel Hill, NC 27599

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-29 Thread Kent Johnson
Chris Calloway wrote:
> Generators now have a different syntax, so some applications would need 
> some updating in order to take advantage of 2.5.

The old syntax still works. "yield x" is now an expression returning a 
value, rather than a statement, so it can be used in new ways, but a 
plain "yield x" is fine.

> The new "with" statement is very cool, though.
> 
>> I've personally held back just because most of the 
>> documentation I've come across is for 2.4,
> 
> 100% of this is Python 2.5 documentation:
> 
> http://docs.python.org/
> 
> Very little of it had to change from the last version.

To amplify this a bit - backward compatibility between Python releases 
is generally excellent. It is rare for something that works in 2.x to 
fail in 2.x+1. There may be a better way to do something using a new 
feature but the old ways will usually work.

So if you are learning Python from a book that covers 2.3 or 2.4, you 
should do fine with 2.5. When you want to know what has been added that 
is not in your book, check the excellent "What's New in Python 2.x" 
guides that are included with the docs for each version. These guides 
also include a "Porting to Python 2.x" section that lists the 
incompatible changes in the new version. For example, see
http://docs.python.org/whatsnew/porting.html

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in a list, using a list comp)

2006-12-29 Thread Bob Gailer
Kent Johnson wrote:
> wesley chun wrote:
>   
>> below is a quick summary of the 2.5 highlights.  of these, i like/use
>> the following:
>> 1, 2, 4, 5, 6, 7, (8), 9a, 9b. 
>>
>> 7) Enhanced Generator Features (PEP 342) -- now you can "talk-back" to
>> a generator, meaning you can send data into it as you resume it...
>> .next() sends None, .send(obj) sends obj, .throw(exc) throws exception
>> exc
>> 
>
> Are you using this? I would be interested in finding out how. \
In the past month I wrote a file parser that is sorta recursive descent. 
I wrote a generator that takes the first token of each file line and 
looks it up in the current keyword list. If not found it stops 
iteration, control returns to a higher level which has its own version 
of the generator instantiated with a different keyword list.

With the ability to pass an object, I can simplify my code so there is 
one instance of the generator, and each level passes its own keyword list.
> This seems 
> like a feature that allows Python to be used in a new way, but I have 
> not yet seen any real applications of it.
>
> Kent
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>   


-- 
Bob Gailer
510-978-4454

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 34, Issue 55

2006-12-29 Thread Tony Cappellini

Message: 1
Date: Thu, 28 Dec 2006 17:24:41 -0800
From: "Chris Hengge" <[EMAIL PROTECTED]>
Subject: Re: [Tutor] OT: Python 2.5 (Was Re: Length of longest item in


I hope this is related enough for this thread, but I'm curious why people
didn't seem to unanimously jump into 2.5 upon release.


One reason- having to upgrade all the packages that you've installed is time
consuming.

Another- we have a very large tools framework where I work. Someone needs to
make sure these tools will work with any new version of Python. We use
2.3at the  moment, and there is no significant reason to upgrade to
2.4 or 2.5, to justify the time involved in testing all the tools to make
sure every line of code is executed with the new version.

As far as my home use, I'm still using 2.4, and will keep it that way until
I need to install something that requires 2.5.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] about reload

2006-12-29 Thread linda.s
I read something about reload of modules.
#test.py
from ABC import M # M is an attribute of Module ABC

if I change module ABC, I need import ABC and reload ABC before "from
ABC import M" work. in IDLE, I just click F5 and run the code, it
works and does not need type anything like "Import ABC",
"Reload(ABC)". Why the book say the two steps are needed?
Thanks,
Linda
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] about reload

2006-12-29 Thread Danny Yoo


On Fri, 29 Dec 2006, linda.s wrote:

> I read something about reload of modules.
> #test.py
> from ABC import M # M is an attribute of Module ABC
>
> if I change module ABC, I need import ABC and reload ABC before "from 
> ABC import M" work. in IDLE, I just click F5 and run the code, it works 
> and does not need type anything like "Import ABC", "Reload(ABC)". Why 
> the book say the two steps are needed?

reload() is necessary if we don't re-run everything from scratch.

When you're pressing F5 in IDLE, IDLE restarts the whole program, so in 
that particular case, you don't need to worry about reload() at all.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] about reload

2006-12-29 Thread Luke Paireepinart
Danny Yoo wrote:
> On Fri, 29 Dec 2006, linda.s wrote:
>
>   
>> I read something about reload of modules.
>> #test.py
>> from ABC import M # M is an attribute of Module ABC
>>
>> if I change module ABC, I need import ABC and reload ABC before "from 
>> ABC import M" work. in IDLE, I just click F5 and run the code, it works 
>> and does not need type anything like "Import ABC", "Reload(ABC)". Why 
>> the book say the two steps are needed?
>> 
>
> reload() is necessary if we don't re-run everything from scratch.
>
> When you're pressing F5 in IDLE, IDLE restarts the whole program, so in 
> that particular case, you don't need to worry about reload() at all.
>   
Actually, if you have IDLE in the default setup on Windows and you 
right-click something to edit it,
IDLE doesn't open a subprocess each time a script is executed, so it 
will keep the imports in between runs of the program.
I.E. if I type "import math" into the IDLE interpreter, I can then make 
a file with the contents
# start

print math.pi

#- end
and it will work.
just thought I'd mention that.
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>   

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Best way to learn python

2006-12-29 Thread Daniel kavic
What is the best way for someone who is not very efficient in  
mathematics to learn Python, I was turned away from C++ and others  
because of the math issue. Ruby has been recommended as well. 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best way to learn python

2006-12-29 Thread Rob Andrews
I'm not exactly a math guru, either, but know some algebra & geometry
from school.

When I first tried my hand at Python, I started with just the tutorial
bundled with the Python download.

I had been taken a semester in Pascal & tinkered with Perl & Java at
that point, and found Python to be simpler & more obvious, so if you
have a bit of programming at all your experience is likely as good as
mine was at the time. What's your programming background?

What sort of programming would you most immediately like to do?

And Ruby's also a fine language.

-Rob A.

On 12/29/06, Daniel kavic <[EMAIL PROTECTED]> wrote:
> What is the best way for someone who is not very efficient in
> mathematics to learn Python, I was turned away from C++ and others
> because of the math issue. Ruby has been recommended as well.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best way to learn python

2006-12-29 Thread Alan Gauld

"Daniel kavic" <[EMAIL PROTECTED]> wrote 
> What is the best way for someone who is not very efficient in  
> mathematics to learn Python, 

You don't need math to program, but it definitely helps and 
for some problems is essential. But the level of math required 
is not high, definitely sub college level for most things.

As a learning language Python is excellent. There are a 
multitude of tutorials listed on the Python web site, including 
mine. Pick one that seems to make sense to you.

> I was turned away from C++ and others  
> because of the math issue. 

> Ruby has been recommended as well. #

Ruby and Python are very similar in many ways, and 
are growing ever closer in some ways. I personally think 
Python edges it for a beginner just because there are 
more books and web sites available, but both are good 
languages.

HTH.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] about reload

2006-12-29 Thread Danny Yoo
> Actually, if you have IDLE in the default setup on Windows and you
> right-click something to edit it,
> IDLE doesn't open a subprocess each time a script is executed, so it
> will keep the imports in between runs of the program.

Hi Luke,

Ah, thanks for the correction.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] XML-RPC data transfers.

2006-12-29 Thread Chris Hengge

I might have been unclear, or this tid-bit might have been lost in the
thread... but I'm trying to send directly from ImageGrab.Grab(), without
saving the data as a file. Thats where I'm getting hung... If it try to send
an actual stored file, I have no problem. Is this maybe impossible? My
thought was that I could just save a little process time and file
fragmentation if I cut out the middle man, plus there really is no reason to
save the screen capture on the server side.

Maybe I really need to look into SOAP for this sort of stuff? I'm just
playing with the technology, and from the searching I've done, the XML-RPC
seemed to fit my needs best. I could certainly be wrong though.

Thanks for both of you giving me feedback.

On 12/29/06, Lee Harr <[EMAIL PROTECTED]> wrote:


>http://www.velocityreviews.com/forums/t343990-xmlrpc-send-file.html
>
>Using this example I get error's about 'expected binary .read(), but got
>instance instead.


I assume you are using this ...

>d = xmlrpclib.Binary(open("C:\\somefile.exe").read())


Are you using windows?

I think you would need to pass the binary flag to open ...

imagedata = open(filename, 'rb').read()



It's probably a good idea to use the binary flag if you are expecting
binary data just in case it gets ported somewhere else later.


>I've just been using xmlrpclib and simplexmlrpcserver for this, but I'm
>wondering if I should perhaps use twisted instead.

I've used xml-rpc to send image data before. It worked.

_
Don't just search. Find. Check out the new MSN Search!
http://search.msn.com/

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] about reload

2006-12-29 Thread linda.s
On 12/29/06, Danny Yoo <[EMAIL PROTECTED]> wrote:
> > Actually, if you have IDLE in the default setup on Windows and you
> > right-click something to edit it,
> > IDLE doesn't open a subprocess each time a script is executed, so it
> > will keep the imports in between runs of the program.
>
> Hi Luke,
>
> Ah, thanks for the correction.
I got confused now:-> if IDLE keeps the imports in between runs of the
program, do I still need import and reload? or click F5 in IDLE is OK?
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor