Re: Why doesn't this work

2014-09-02 Thread Seymore4Head
On Tue, 02 Sep 2014 16:13:39 -0400, Seymore4Head wrote: >I still can't get the syntax >test='Hey buddy get away from my car' >if test[0].alpha(): >return True I have a huge head cold right now. Never mind the question. Sorry -- https://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't this work

2014-09-02 Thread Skip Montanaro
On Tue, Sep 2, 2014 at 3:13 PM, Seymore4Head wrote: > I still can't get the syntax > test='Hey buddy get away from my car' > if test[0].alpha(): > return True > My guess is you meant isalpha(), as Mark indicated. Here's a cheap way to see what an object can do: >>> test='Hey buddy get away

Re: Why doesn't this work

2014-09-02 Thread Mark Lawrence
On 02/09/2014 21:13, Seymore4Head wrote: I still can't get the syntax test='Hey buddy get away from my car' if test[0].alpha(): return True isalpha? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.p

Re: Why doesn't this work

2014-09-02 Thread Chris Angelico
On Wed, Sep 3, 2014 at 6:13 AM, Seymore4Head wrote: > I still can't get the syntax > test='Hey buddy get away from my car' > if test[0].alpha(): > return True If that's not in a function, "return" makes no sense, as the SyntaxError will have told you. As to the actual check, that's isalpha(),

Re: Why doesn't this work

2014-09-02 Thread Ned Batchelder
On 9/2/14 4:13 PM, Seymore4Head wrote: I still can't get the syntax test='Hey buddy get away from my car' if test[0].alpha(): return True A really good skill to learn early on is how to ask for help. You need to tell us what you expected it to do, and also what it did that displeased y

Re: Why doesn't this work ? For loop variable scoping ?

2009-03-20 Thread Gabriel Genellina
En Thu, 19 Mar 2009 19:33:36 -0300, Ryan Kelly escribió: newCylinderTempertature = newCylinderTemperature + deltaTemp Take a careful look at the variable name here: "Tempertature". Python's dynamic nature provides a lot of wonderful benefits, but you've just hit one of the drawbacks

Re: Why doesn't this work ? For loop variable scoping ?

2009-03-19 Thread Aahz
In article , Linuxguy123 wrote: > >I've got a small piece of code that I don't understand. Basically, a >variable inside an if statement inside a for loop doesn't seem to be >updating. Is this a scope issue ? Nope, it's a spelling issue. I suggest you change your code to a more readable: new

Re: Why doesn't this work ? For loop variable scoping ?

2009-03-19 Thread Benjamin Peterson
Linuxguy123 gmail.com> writes: > > > Hi people. > > I've got a small piece of code that I don't understand. Basically, a > variable inside an if statement inside a for loop doesn't seem to be > updating. Is this a scope issue ? No, it's because you mispelled the variables. -- http://ma

Re: Why doesn't this work ? For loop variable scoping ?

2009-03-19 Thread Ryan Kelly
> newCylinderTempertature = newCylinderTemperature + deltaTemp Take a careful look at the variable name here: "Tempertature". Python's dynamic nature provides a lot of wonderful benefits, but you've just hit one of the drawbacks - you don't get any protection from typos in variable names.

Re: Why doesn't this work in Eclipse ? (Simple pexpect code that works in bash)

2009-01-30 Thread Gary Duzan
On Jan 30, 11:03 am, Linuxguy123 wrote: > I'm trying to build a small Python app in Eclipse under Fedora 10. > > I have the following code: > > import os > import sys > import pexpect > > child = pexpect.spawn('/bin/bash') > child.interact() > > When I run it in Eclipse, I get: > > Traceback (most

Re: Why doesn't this work?

2006-10-21 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Larry Bates <[EMAIL PROTECTED]> wrote: > Because datetime is a new-style class: Ah. > The Constructor __new__ > > If you are like me, then you probably always thought of the __init__ method > as > the Python equivalent of what is called a constructor in C++. Th

Re: Why doesn't this work?

2006-10-21 Thread Larry Bates
Because datetime is a new-style class: The Constructor __new__ If you are like me, then you probably always thought of the __init__ method as the Python equivalent of what is called a constructor in C++. This isn't the whole story. When an instance of a class is created, Python first calls the _

Re: Why doesn't this work--Extending Python--?

2006-01-04 Thread jeremito
Well what do you know, that worked! It's one of those errors that you can't see yourself, but someone else can see it instantly. Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't this work--Extending Python--?

2006-01-04 Thread Todd
jeremito wrote: > I have written a simple C++ program in my efforts to learn how to > extend Python. It is shown below. Everything compiles and installs > correctly, but I get strange answers. I know the function "Pi" is > correct because when I call it from a C++ code it gives the correct > ans

Re: Why doesn't this work? :)

2005-10-28 Thread Alex Martelli
Jeremy Moles <[EMAIL PROTECTED]> wrote: > Am I misunderstanding something fundamental about the builtin __* > functions? Can they not be "static?" They can and must be static when their specification say they are (e.g., __new__) and they cannot and must not be static when their specification says

Re: Why doesn't this work? :)

2005-10-28 Thread Jeremy Moles
On Fri, 2005-10-28 at 14:50 -0400, Chris Lambacher wrote: > I think what you really want is: > > try: > # this will fail and be caught > # below, w > import foobar > > except ImportError, error: > class foobarclass: > def __getattr__(*args, **kargs): >

Re: Why doesn't this work? :)

2005-10-28 Thread Chris Lambacher
I think what you really want is: try: # this will fail and be caught # below, w import foobar except ImportError, error: class foobarclass: def __getattr__(*args, **kargs): return None foobar = foobarclass() print fo