Re: [Tutor] Functions returning multiple values

2010-02-23 Thread Giorgio
I have an update: I can easily undertand why this example doesn't work: def nochange(x): x = 0 y = 1 nochange(y) print y # Prints out 1 X is a local variable, and only gets modified in the function, that doesn't return any value. But it's very difficult for me to understand WHY this works:

Re: [Tutor] Functions returning multiple values

2010-02-23 Thread Christian Witts
Giorgio wrote: I have an update: I can easily undertand why this example doesn't work: def nochange(x): x = 0 y = 1 nochange(y) print y # Prints out 1 X is a local variable, and only gets modified in the function, that doesn't return any value. But it's very difficult for me to underst

[Tutor] nonlocal variables

2010-02-23 Thread Vladislav Vorobyov
#!/usr/bin/python def func_outer(): x = 2 print('x is', x) def func_inner(): nonlocal x x = 5 func_inner() print('Changed local x to', x) func_outer() Output: File "nonlocal_var.py", line 6 nonlocal x ^ Synta

Re: [Tutor] Functions returning multiple values

2010-02-23 Thread Giorgio
Thankyou. It's clear, this definitely helps me with the first question. But still doesn't explain almost anything about the example i've posted in the last post, right? Giorgio 2010/2/23 Christian Witts > Giorgio wrote: > >> I have an update: >> >> I can easily undertand why this example doesn

Re: [Tutor] nonlocal variables

2010-02-23 Thread Hugo Arts
On Tue, Feb 23, 2010 at 1:38 PM, Vladislav Vorobyov wrote: > #!/usr/bin/python > def func_outer(): >     x = 2 >     print('x is', x) >     def func_inner(): >     nonlocal x >     x = 5 >     func_inner() >     print('Changed local x to', x) > > func_ou

Re: [Tutor] nonlocal variables

2010-02-23 Thread Vladislav Vorobyov
2010/2/23 Hugo Arts > On Tue, Feb 23, 2010 at 1:38 PM, Vladislav Vorobyov > wrote: > > #!/usr/bin/python > > def func_outer(): > > x = 2 > > print('x is', x) > > def func_inner(): > > nonlocal x > > x = 5 > > func_inner() > >

Re: [Tutor] Functions returning multiple values

2010-02-23 Thread Hugo Arts
On Tue, Feb 23, 2010 at 1:13 PM, Giorgio wrote: > I have an update: > I can easily undertand why this example doesn't work: > def nochange(x): >     x = 0 > y = 1 > nochange(y) > print y # Prints out 1 > X is a local variable, and only gets modified in the function, that doesn't > return any value

Re: [Tutor] Functions returning multiple values

2010-02-23 Thread Giorgio
Thankyou Hugo! Ok, so i think the key is of my problem is that when doing X = 0 i'm creating a new object, that only exist in the local namespace. BUT, when using a list as a parameter for a function i'm only giving it a new name, but the object it's referring to it's always the same, and is in th

Re: [Tutor] list to numpy record array

2010-02-23 Thread Kent Johnson
On Mon, Feb 22, 2010 at 11:50 PM, Vincent Davis wrote: > > I must be missing something simple. I have a list of lists data = "[['  0', ' >  0', '234.0', '24.0', ' 25'], ['  1', '  0', '22428.0', '2378.1', ' > 25'],.." and what to make a record array from it but it gets screwed up > or I don

Re: [Tutor] Functions returning multiple values

2010-02-23 Thread Hugo Arts
On Tue, Feb 23, 2010 at 2:28 PM, Giorgio wrote: > Thankyou Hugo! > Ok, so i think the key is of my problem is that when doing X = 0 i'm > creating a new object, that only exist in the local namespace. BUT, when > using a list as a parameter for a function i'm only giving it a new name, > but the o

[Tutor] Running PIL.Image on .svg file

2010-02-23 Thread Dayo Adewunmi
Hi all When i use PIL.Image in this script:http://dpaste.com/163588/ on an .svg file, I get this error:http://dpaste.com/163584/ How do i process .svg files in python? Thanks Dayo ___ Tutor maillist - Tutor@python.org To unsubscribe o

[Tutor] Verifying My Troublesome Linkage Claim between Python and Win7

2010-02-23 Thread Wayne Watson
A few days ago I posted a message titled ""Two" Card Monty. The problem I mentioned looks legitimate, and remains puzzling. I've probed this in a newsgroup, and no one has an explanation that fits. My claim is that if one creates a program in a folder that reads a file in the folder it and the

[Tutor] What Editori?

2010-02-23 Thread Giorgio
Hi All, what text-editor do you use for python? I've always used kate/nano on Linux and Notepad++/PSPad on Win. Today i've installed portablepython to my pendrive, and found pyscripter in that. It's nice! Do you think it's a good editor? Do you know other names? Giorgio -- -- AnotherNetFellow

Re: [Tutor] What Editori?

2010-02-23 Thread Steve Willoughby
On Tue, Feb 23, 2010 at 05:24:13PM +0100, Giorgio wrote: > what text-editor do you use for python? While the can of worms that particular question tends to open is always an issue (for some reason people get very emotionally passionate about why their editor is the best) I'm not sure you're going

Re: [Tutor] What Editori?

2010-02-23 Thread Giorgio
Definitely i just use pyscripter because it has the py idle integrated in the window. It's very useful! 2010/2/23 Steve Willoughby > On Tue, Feb 23, 2010 at 05:24:13PM +0100, Giorgio wrote: > > what text-editor do you use for python? > > While the can of worms that particular question tends t

Re: [Tutor] What Editori?

2010-02-23 Thread spir
On Tue, 23 Feb 2010 17:46:24 +0100 Giorgio wrote: > Definitely i just use pyscripter because it has the py idle integrated in > the window. > > It's very useful! Most editors have an integreated console that allow typing commands, launching the interactice interpreter, and running progs all wi

Re: [Tutor] What Editori?

2010-02-23 Thread Randy Raymond
I use Editra. Randy -- From: "spir" Sent: Tuesday, February 23, 2010 11:13 AM To: Subject: Re: [Tutor] What Editori? On Tue, 23 Feb 2010 17:46:24 +0100 Giorgio wrote: Definitely i just use pyscripter because it has the py idle integrated in

Re: [Tutor] What Editori?

2010-02-23 Thread Steve Willoughby
On Tue, Feb 23, 2010 at 06:13:51PM +0100, spir wrote: > I use geany which is imo good for every language... and has the absolutely > necessary duplicate feature ;-) (*). Most have a variety of features which could be called by that name. What specifically are you referring to here? -- Steve Will

Re: [Tutor] list to numpy record array

2010-02-23 Thread Vincent Davis
@Kent All I know about RecordArrays is from reading this page: http://www.scipy.org/RecordArrays but it looks like you have done the right thing and created a RecordArray. What is wrong with this result? The number are completely different, or I have no idea how to read it. Here are the first row

Re: [Tutor] list to numpy record array

2010-02-23 Thread Skipper Seabold
On Mon, Feb 22, 2010 at 11:50 PM, Vincent Davis wrote: > > I must be missing something simple. I have a list of lists data = "[['  0', ' >  0', '234.0', '24.0', ' 25'], ['  1', '  0', '22428.0', '2378.1', ' > 25'],.." and what to make a record array from it but it gets screwed up > or I don

Re: [Tutor] Searchlight/MVPA/ValueError

2010-02-23 Thread Eike Welk
Hey J! On Monday February 22 2010 22:48:11 J wrote: > Dear all, > I am trying to run a very simple searchlight on fMRI data via PyLab (on Mac > Leopard). > > My code is as follows: > > from mvpa.suite import * > import os > from matplotlib.pyplot import figure, show > from mvpa.misc.io.base impo

Re: [Tutor] list to numpy record array

2010-02-23 Thread Vincent Davis
@Skipper Thanks I will post over on the scipy list *Vincent Davis 720-301-3003 * vinc...@vincentdavis.net my blog | LinkedIn On Tue, Feb 23, 2010 at 10:55 AM, Skipper Seabold wrote: > On Mon, Feb 22, 2010 at 11:50 PM, Vincen

Re: [Tutor] What Editori?

2010-02-23 Thread Lowell Tackett
The environment [OS} of choice can do a lot to expand/enhance the capabilities of an editor.  I fell upon Vim from the beginning, and stayed with it for its' rich palate of features and adaptability (and of course, the often...and exhilarating "oh, Vim can do that!").  But beyond that, the Linux

Re: [Tutor] Functions returning multiple values

2010-02-23 Thread Giorgio
Ok Hugo, so, going back to your example: def nochange(some_list): # create shallow copy of list. NOTE: Shallow copies may still bite you if you change the list members. some_list = some_list[:] some_list[1] = 2 Here we've created a new list. It's an object in the global "object-space :)

Re: [Tutor] What Editori?

2010-02-23 Thread Wayne Werner
On Tue, Feb 23, 2010 at 10:24 AM, Giorgio wrote: > Hi All, > > what text-editor do you use for python? > I use vim - for me it's the hands-down best editor. I usually have two terminals (I run linux) open - one for ipython, and one for vim. I usually have vim split into several buffers for each o

Re: [Tutor] What Editori?

2010-02-23 Thread Randy Raymond
I use Editra. Randy -- From: "spir" Sent: Tuesday, February 23, 2010 11:13 AM To: Subject: Re: [Tutor] What Editori? On Tue, 23 Feb 2010 17:46:24 +0100 Giorgio wrote: Definitely i just use pyscripter because it has the py idle integrated in

Re: [Tutor] Functions returning multiple values

2010-02-23 Thread Kent Johnson
On Tue, Feb 23, 2010 at 1:55 PM, Giorgio > And, please let me ask a question: Kent told that nested_namespace(s) are > default in python 2.6. And i found a line confirming this in py2.6 library. > But, what about python 2.5 that as you know is the default on linux? Yes, since 2.2 nested namespaces

Re: [Tutor] What Editori?

2010-02-23 Thread wesley chun
> what text-editor do you use for python? as an FYI Guido himself uses both emacs and vi/m... he mentioned this during his PyCon 2010 keynote last week, to which someone tweeted: http://twitter.com/bradallen137/status/9337630806 i primarily use vi/m and emacs as necessary, -- wesley - - - - - -

Re: [Tutor] Running PIL.Image on .svg file

2010-02-23 Thread Eduardo Vieira
On Tue, Feb 23, 2010 at 7:27 AM, Dayo Adewunmi wrote: > Hi all > > When i use PIL.Image in this script:http://dpaste.com/163588/  on an .svg > file, I get this error:            http://dpaste.com/163584/ > How do i process .svg files in python? > Thanks > > Dayo > > ___

Re: [Tutor] What Editori?

2010-02-23 Thread Alan Gauld
"Steve Willoughby" wrote Actually, I suppose even ed and TECO qualify for some work models ;) I even use edlin occasionally - usually in batch files... But Teco is the only editor that I've given up on as being just to hard to use! And that's out of more than a couple of dozen editor

Re: [Tutor] What Editori?

2010-02-23 Thread Alan Gauld
"Giorgio" wrote Definitely i just use pyscripter because it has the py idle integrated in the window. PyScripter is an alternative to IDLE but it doesn't have IDLE embedded within it. I think you are getting confused between IDLE and the Python interactive prompt which is available in severa

Re: [Tutor] What Editori?

2010-02-23 Thread Alan Gauld
"spir" wrote ...and has the absolutely necessary duplicate feature ;-) (*). (*) Does anyone know another editor that has it? OK, I'll bite. What is the duplicate feature? :-) Alan G ___ Tutor maillist - Tutor@python.org To unsubscribe or change

Re: [Tutor] What Editori?

2010-02-23 Thread Giorgio
Yes sorry Alan i've only used the wrong word :D I know the difference :) Giorgio 2010/2/23 Alan Gauld > > "Giorgio" wrote > > Definitely i just use pyscripter because it has the py idle integrated in >> the window. >> > > PyScripter is an alternative to IDLE but it doesn't have IDLE embedded

Re: [Tutor] What Editori?

2010-02-23 Thread Alan Gauld
"Wayne Werner" wrote I use vim - for me it's the hands-down best editor. I usually have two terminals (I run linux) open - one for ipython, and one for vim. I usually have vim split into several buffers for each of the files I'm editing, and I have some nice scripts and plugins that help me

[Tutor] Python 3 Statistics?

2010-02-23 Thread James Reynolds
Hi All, I am brand new to python and programing in general. I've been writing a program that will eventually run a monte carlo simulation of some mortality events and I've been making decent progress so far. I decided to use Python 3, as a long term decision, but getting access to modules seems t

Re: [Tutor] What Editori?

2010-02-23 Thread Giorgio
O_O. I've downloaded some python examples from my debian server. Then, have edited one of them with pyscript. The IDLE (the real idle alan :D) was giving out a "unexpected indent" error, so i've checked again and again the code -it was ok-. Then, i've opened it in the IDLE. And there, ONLY there

Re: [Tutor] Python 3 Statistics?

2010-02-23 Thread Steven D'Aprano
On Wed, 24 Feb 2010 07:43:28 am James Reynolds wrote: > For me to progress further though, I need to do some statistics work > in Python. Does anyone know of a python module in Python 3.1 which > will allow me to do statistics work? Otherwise I will have to go back > to Python 2.5? to get numpy an

Re: [Tutor] Running PIL.Image on .svg file

2010-02-23 Thread Dayo Adewunmi
Eduardo Vieira wrote: On Tue, Feb 23, 2010 at 7:27 AM, Dayo Adewunmi wrote: Hi all When i use PIL.Image in this script:http://dpaste.com/163588/ on an .svg file, I get this error:http://dpaste.com/163584/ How do i process .svg files in python? Thanks Dayo

Re: [Tutor] What Editori?

2010-02-23 Thread Luke Paireepinart
On Tue, Feb 23, 2010 at 3:08 PM, Giorgio wrote: > O_O. > > I've downloaded some python examples from my debian server. Then, have > edited one of them with pyscript. The IDLE (the real idle alan :D) was > giving out a "unexpected indent" error, so i've checked again and again the > code -it was o

Re: [Tutor] What Editori?

2010-02-23 Thread Benno Lang
On 24 February 2010 01:24, Giorgio wrote: > what text-editor do you use for python? I use jEdit, and without a GUI I guess I'd use nano - I'm not the sort who likes reading manuals in order to use a text editor. Many years ago when I was on Windows I used to use TextPad. Then I started using jEdi

Re: [Tutor] Strange list behaviour in classes

2010-02-23 Thread C M Caine
On 22 February 2010 23:28, Wayne Werner wrote: > On Mon, Feb 22, 2010 at 4:10 PM, C M Caine wrote: >> >> Or possibly strange list of object behaviour >> >> IDLE 2.6.2 >> >>> class Player(): >>        hand = [] >> >> >> >>> Colin = Player() >> >>> Alex = Player() >> >>> >> >>> Players = [Colin, Al

Re: [Tutor] Verifying My Troublesome Linkage Claim between Python and Win7

2010-02-23 Thread Dave Angel
Wayne Watson wrote: A few days ago I posted a message titled ""Two" Card Monty. The problem I mentioned looks legitimate, and remains puzzling. I've probed this in a newsgroup, and no one has an explanation that fits. My claim is that if one creates a program in a folder that reads a file in

Re: [Tutor] Using Python with a Mac

2010-02-23 Thread Eric Dorsey
Not sure if this is what you're asking, but you can invoke the Python interpreter from the command line (Terminal) Open a new terminal, and at the $ prompt just type "python".. $ python Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "co

Re: [Tutor] What Editori?

2010-02-23 Thread Eric Dorsey
On any platform, I use (gui) vim (gvim on Win/Linux, mvim/macvim on OSX) with this plugin: http://www.vim.org/scripts/script.php?script_id=30 On Tue, Feb 23, 2010 at 5:40 PM, Benno Lang wrote: > On 24 February 2010 01:24, Giorgio wrote: > > what text-editor do you use for python? > > > __

[Tutor] webmail client for pop3 in python

2010-02-23 Thread Kirk Bailey
Anyone knoow of a good python Webmail client in python for my windows notebook? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] webmail client for pop3 in python

2010-02-23 Thread Lie Ryan
On 02/24/10 13:53, Kirk Bailey wrote: > Anyone knoow of a good python Webmail client in python for my windows > notebook? what do you mean by "python webmail client"? Could you elaborate? If you want to send email programmatically, use the smtplib module if the server supports SMTP.

Re: [Tutor] Strange list behaviour in classes

2010-02-23 Thread Lie Ryan
On 02/24/10 10:27, C M Caine wrote: > Thanks all (again). I've read the classes tutorial in its entirety > now, the problem I had didn't seem to have been mentioned at any point > explicitly. I'm still a fairly inexperienced programmer, however, so > maybe I missed something in there or maybe this

Re: [Tutor] Strange list behaviour in classes

2010-02-23 Thread James Reynolds
This thread inspired me to start learning object oriented as well, but it seems I must be missing something fundamental. If I could get an explanation of why I am raising the following exception, I would greatly appreciate it. I'm getting: Traceback (most recent call last): File "C:\Python31\Li

[Tutor] ask

2010-02-23 Thread Shurui Liu (Aaron Liu)
This time is not my assignment, I promise. In python, when we want to list numbers, we use the command "range", like, if we want to list integer from 0 to 9, we can write: range(10); if we want to list integer from 10 to 29, we can write: range(10,30). I was going to show a list of number from 1.0

Re: [Tutor] ask

2010-02-23 Thread Benno Lang
On 24 February 2010 12:58, Shurui Liu (Aaron Liu) wrote: > This time is not my assignment, I promise. > > In python, when we want to list numbers, we use the command "range", like, > if we want to list integer from 0 to 9, we can write: range(10); if we want > to list integer from 10 to 29, we can

Re: [Tutor] Using Python with a Mac

2010-02-23 Thread Zack Jarrett
Even though it's written for kids "Snake Wrangling for Kids" is a good resource to get you started with writing Python code. Don't be put off by the title or the target audience; seriously. This book will have you writing and executing Python scripts by page 8. You can get it from: http://cod

Re: [Tutor] What Editori?

2010-02-23 Thread Christian Witts
Giorgio wrote: Hi All, what text-editor do you use for python? I've always used kate/nano on Linux and Notepad++/PSPad on Win. Today i've installed portablepython to my pendrive, and found pyscripter in that. It's nice! Do you think it's a good editor? Do you know other names? Giorgio --