Re: [Tutor] if n == 0 vs if not n

2009-10-05 Thread Luke Paireepinart
On Mon, Oct 5, 2009 at 9:28 PM, Sander Sweers wrote: > > Hi Tutors, > > I am going through someone's python script and I am seeing a lot of the > following boolean checks. > > if not s == "" > > if not n == 0 > > if b == True > > if not b == True > > etc.. > > All of these can be written without t

Re: [Tutor] if n == 0 vs if not n

2009-10-05 Thread Vern Ceder
Dave Angel wrote: Now in this case where it is only used as boolean checks which would be the most pythonic way if writing these checks? The shorter version may be preferable, but it doesn't generally give the same results. Without knowing the possible data, these substitutions are not saf

Re: [Tutor] if n == 0 vs if not n

2009-10-05 Thread Dave Angel
Vern Ceder wrote: Hi Sander, PEP 8, the "Style Guide for Python Code" http://www.python.org/dev/peps/pep-0008/ is pretty clear that the shorter version is preferable: if s: if n: if b: if not b: and so on... Cheers, Vern Sander Sweers wrote: Hi Tutors, I am going through someone's pytho

Re: [Tutor] Which version to start with?

2009-10-05 Thread Nick Hird
Thanks all! I think i will install the newly released 2.6.3 and go from there. Its a little intimidating but i guess i gotta jump right in and get my feet wet. Thanks again! -Nick On Mon, Oct 5, 2009 at 5:59 PM, wesley chun wrote: > On Mon, Oct 5, 2009 at 2:24 PM, Nick Hird wrote: >> What is th

Re: [Tutor] Poorly understood error involving class inheritance

2009-10-05 Thread Kent Johnson
On Mon, Oct 5, 2009 at 4:41 PM, David Perlman wrote: > I fixed this by changing it to "mods=None" and then setting it in the body > of the __init__ method.  Works fine now. That is the correct fix. > My question is, is this just a quirky misbehavior, or is there a principled > reason why the co

Re: [Tutor] Which version to start with?

2009-10-05 Thread wesley chun
On Mon, Oct 5, 2009 at 2:24 PM, Nick Hird wrote: > What is the best version of python to start out with? I see some > discussions on the net about not going to 3.1 but staying with the 2.x > releases. But then i see that 3.1 is better if your just starting. greetings nick! ironically, i just ga

Re: [Tutor] if n == 0 vs if not n

2009-10-05 Thread wesley chun
> I am going through someone's python script and I am seeing a lot of the > following boolean checks. > > if not s == "" > if not n == 0 > if b == True > if not b == True > etc.. > > All of these can be written without the == notation like "if n", "if s" > etc.Now in this case where it is only used

Re: [Tutor] Poorly understood error involving class inheritance

2009-10-05 Thread wesley chun
>    def __init__(self, time, mods=[], dur=None, format='%1.2f'): >        : > The mods that were added to the first instance of oneStim also appear in the > second, newly created instance! > > It appears that what is happening here is that the __init__() method is > being parsed by the interpreter

Re: [Tutor] Which version to start with?

2009-10-05 Thread Wayne
On Mon, Oct 5, 2009 at 4:24 PM, Nick Hird wrote: > What is the best version of python to start out with? I see some > discussions on the net about not going to 3.1 but staying with the 2.x > releases. But then i see that 3.1 is better if your just starting. > Thanks for any insight on which versi

Re: [Tutor] Which version to start with?

2009-10-05 Thread Rich Lovely
2009/10/5 Nick Hird : > What is the best version of python to start out with? I see some > discussions on the net about not going to 3.1 but staying with the 2.x > releases. But then i see that 3.1 is better if your just starting. > Thanks for any insight on which version to go with. > -Nick >

Re: [Tutor] Poorly understood error involving class inheritance

2009-10-05 Thread Wayne
On Mon, Oct 5, 2009 at 3:41 PM, David Perlman wrote: > OK, I thought I had this one fixed but it was weirder than I thought. I > think I understand what's going on, but I wanted to check with the experts > here. > > I have the following class definition, which does not subclass anything: > > cla

[Tutor] Which version to start with?

2009-10-05 Thread Nick Hird
What is the best version of python to start out with? I see some discussions on the net about not going to 3.1 but staying with the 2.x releases. But then i see that 3.1 is better if your just starting. Thanks for any insight on which version to go with. -Nick __

Re: [Tutor] Poorly understood error involving class inheritance

2009-10-05 Thread bob gailer
David Perlman wrote: OK, I thought I had this one fixed but it was weirder than I thought.  I think I understand what's going on, but I wanted to check with the experts here. I have the following class definition, which does not subclass anything: class oneStim:     def __init__(

Re: [Tutor] small program

2009-10-05 Thread Kent Johnson
This language is not appropriate for this list and I'm sorry to see it used even in a private reply. Let's keep the discussions here polite and respectful. Thanks, Kent On Sun, Oct 4, 2009 at 8:40 AM, Luke Paireepinart wrote: > > > On Sun, Oct 4, 2009 at 1:59 PM, Andrius wrote: >> >> Very good.

Re: [Tutor] New to python: some advises for image processing tool

2009-10-05 Thread Wayne
I think you forgot to hit Reply-all, so forwarding on to the list with my response On Mon, Oct 5, 2009 at 11:38 AM, Nicola De Quattro < lead.express...@gmail.com> wrote: > Wayne ha scritto: > >> The most difficult task would be analyzing the image and possibly some of >> the graph generation. >>

Re: [Tutor] if n == 0 vs if not n

2009-10-05 Thread Sander Sweers
Thanks Wesly/Vern for the replies. On Mon, 2009-10-05 at 21:56 +0200, Luke Paireepinart wrote: > if not n == 0 > > if b == True can be written as if b. > > > However, > if not n == 0 can be written as if n != 0 but NOT as if n. > The reason why is that 0 is not equivalent to False even

Re: [Tutor] Poorly understood error involving class inheritance

2009-10-05 Thread David Perlman
OK, I thought I had this one fixed but it was weirder than I thought. I think I understand what's going on, but I wanted to check with the experts here. I have the following class definition, which does not subclass anything: class oneStim: def __init__(self, time, mods=[], dur=None, fo

Re: [Tutor] if n == 0 vs if not n

2009-10-05 Thread Vern Ceder
Hi Sander, PEP 8, the "Style Guide for Python Code" http://www.python.org/dev/peps/pep-0008/ is pretty clear that the shorter version is preferable: if s: if n: if b: if not b: and so on... Cheers, Vern Sander Sweers wrote: Hi Tutors, I am going through someone's python script and I am s

Re: [Tutor] Using command line tool with python script

2009-10-05 Thread Rüdiger Wolf
On Mon, 05 Oct 2009 12:59 -0400, "Kent Johnson" wrote: > On Mon, Oct 5, 2009 at 10:22 AM, Oleg Oltar > wrote: > > > os.popen4("application -parameter1 -file temp.txt") > > > > I wonder if that possible to execute this script (called application) > > without writing the file with initial data to

[Tutor] if n == 0 vs if not n

2009-10-05 Thread Sander Sweers
Hi Tutors, I am going through someone's python script and I am seeing a lot of the following boolean checks. if not s == "" if not n == 0 if b == True if not b == True etc.. All of these can be written without the == notation like "if n", "if s" etc. Now in this case where it is only used

Re: [Tutor] small program

2009-10-05 Thread Andrius
Bye bye. Regards, Andrius On 04/10/2009, Luke Paireepinart wrote: > On Sun, Oct 4, 2009 at 1:59 PM, Andrius wrote: > >> Very good. Nice to hear that from another 'untouchable'. Must to >> confirm for your that I'm usually left wing fella, so, if you have >> nothing what to say for my in my cas

Re: [Tutor] Using command line tool with python script

2009-10-05 Thread Kent Johnson
On Mon, Oct 5, 2009 at 10:22 AM, Oleg Oltar wrote: > os.popen4("application -parameter1 -file temp.txt") > > I wonder if that possible to execute this script (called application) > without writing the file with initial data to the hard disk? If "application" can take its input from stdin then yo

Re: [Tutor] Using command line tool with python script

2009-10-05 Thread bob gailer
Oleg Oltar wrote: Hi! I want to try to use a command line script with my python application. The task is the following, my database stores some initial data for the script and I need to execute a command line application in a following way: $ application -parameter1 -file1 where file 1 is a

[Tutor] Using command line tool with python script

2009-10-05 Thread Oleg Oltar
Hi! I want to try to use a command line script with my python application. The task is the following, my database stores some initial data for the script and I need to execute a command line application in a following way: $ application -parameter1 -file1 where file 1 is a file which contains my

Re: [Tutor] using easy_install to download eggs

2009-10-05 Thread Rüdiger Wolf
Snip from PIP http://pypi.python.org/pypi/pip/0.4 Differences From easy_install pip cannot install some packages. Specifically: * It cannot install from eggs. It only installs from source. (Maybe this will be changed sometime, but it's low priority.) If you want to download eggs then you

Re: [Tutor] using easy_install to download eggs

2009-10-05 Thread Tim Michelsen
Hi, thanks for the hint. > pip (http://pypi.python.org/pypi/pip/) is a drop-in replacement for the > easy_install tool and can do that. > > Just run easy_install pip and set an environment variable > PIP_DOWNLOAD_CACHE to the path you want pip to store the files. Note > that the cache won't work

Re: [Tutor] using easy_install to download eggs

2009-10-05 Thread Rüdiger Wolf
http://stackoverflow.com/questions/529425/easyinstall-cache-downloaded-files pip (http://pypi.python.org/pypi/pip/) is a drop-in replacement for the easy_install tool and can do that. Just run easy_install pip and set an environment variable PIP_DOWNLOAD_CACHE to the path you want pip to store th