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
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
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
ou. As to the actual check, that's
isalpha(), not alpha(), as you can see from the docs.
Suggestion: Choose subject lines that reflect the subject matter being
discussed. "Why doesn't this work" isn't very helpful. :)
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
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
I still can't get the syntax
test='Hey buddy get away from my car'
if test[0].alpha():
return True
--
https://mail.python.org/mailman/listinfo/python-list
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
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
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
> 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.
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 ?
Thanks
Code segment:
# run through the cycle and calculate the temperature and pressure at
each position,
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
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 recent call last):
File "/home/xxx/workspace/FixPermissions/s
En Wed, 02 Jan 2008 01:11:12 -0300, <[EMAIL PROTECTED]> escribió:
> I am trying to experiment a little bit with new-style class and I am
> confused why following example always returns 0 (zero). I was
> expecting will return values from 0 to 9 and finaly
> an Exception.
>
> class GenExample(objec
Steven,
thanks for a nice explanation.
I am trying to experiment a little bit with new-style class and I am
confused why following example always returns 0 (zero). I was
expecting will return values from 0 to 9 and finaly
an Exception.
class GenExample(object):
def getInfo(self):
fo
On Tue, 01 Jan 2008 13:01:24 -0800, petr.jakes.tpc wrote:
>> > My question is: is it possible to set the "property" for any
>> > attribute when I do not know what will be the name of the attribute
>> > in the future?
>>
>> Uhm... I don't understand the question. Perhaps if you think of a
>> concre
> > My question is: is it possible to set the "property" for any attribute
> > when I do not know what will be the name of the attribute in the
> > future?
>
> Uhm... I don't understand the question. Perhaps if you think of a concrete
> case...?
Thanks for reply,
few minutes after i posted my que
En Tue, 01 Jan 2008 16:57:41 -0200, <[EMAIL PROTECTED]> escribi�:
> Gabriel, if I understand it properly, it is necessary to define get/
> set/del/doc methods for each attribute for which I want to set the
> "property" data descriptor (which triggers get/set/del/doc function
> calls upon access to
Hi all,
I am trying to understand new-style classes in Python and I have found
your postings here.
Gabriel, if I understand it properly, it is necessary to define get/
set/del/doc methods for each attribute for which I want to set the
"property" data descriptor (which triggers get/set/del/doc fun
En Mon, 31 Dec 2007 16:01:38 -0200, <[EMAIL PROTECTED]> escribi�:
> Thanks you Gabriel and Timm for your thoughtful responses. I am very
> appreciative.
>
> I had heard about the properties function, but wanted to understand
> the old syntax first before I tried that. Thanks to your responses, I
I didn't actually answer your question, my apologies!
The reason you're failing is due to your use of the __setattr__ call.
Remember, when you override __setattr__, you need to handle *all* of the
logic behind setting object attributes. You're only attempting to do so
when handling the 'name' pro
Thanks you Gabriel and Timm for your thoughtful responses. I am very
appreciative.
I had heard about the properties function, but wanted to understand
the old syntax first before I tried that. Thanks to your responses, I
was able to see what the problem was.
Here is a solution I came up with:
A couple items of note:
> class Person:
This should be "class Person(object)" to take advantage of some
of the features that new-style classes offer...particularly in
this case.
> def __init__(self, fName="", lName=""):
> self.__fName = fName
> self.__lName = lName
>
> d
En Mon, 31 Dec 2007 14:56:02 -0200, <[EMAIL PROTECTED]> escribi�:
> Hi Python Community:
>
> Despite my new-ness to Python I have alreadhy been able to do some (I
> think) amazing things. It is a truly elegant and smart language.
>
> Yet, I can not seem to get a handle on something simple.
>
> I
Perhaps you'd be better off using a standard property? Within your Person
class, you can define a property 'name' to handle what you're trying to do:
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "copyright", "credits" or "license()" for
Hi Python Community:
Despite my new-ness to Python I have alreadhy been able to do some (I
think) amazing things. It is a truly elegant and smart language.
Yet, I can not seem to get a handle on something simple.
I would like to make a class which has private varaiables fName and
lName. It sh
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
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 _
Python 2.3.5 (#1, Jan 30 2006, 13:30:29)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1819)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> class ts(datetime):
... def __init__(self): pass
...
>>> ts()
Traceback (most rece
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
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
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
answers. This is what I get
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
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):
>
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
Jumping right into the code (which should speak for itself):
# ---
try:
# this will fail and be caught
# below, w
import foobar
except ImportError, error:
class foobar:
@staticmethod
def __getattr
On Tue, 22 Mar 2005 12:10:50 +0100, Bouke Woudstra
<[EMAIL PROTECTED]> wrote:
> for flac in flacfiles:
> cmd = 'metaflac --export-tags=- "%s"' % flac
> for line in os.popen(cmd).readlines():
> if 'Artist
On Tue, 22 Mar 2005 09:21:49 -0800, Scott David Daniels <[EMAIL PROTECTED]>
wrote:
>Bouke Woudstra wrote:
>> It turned out that some flac files have tags like Artist=artistname and
>> others
>> have artist=artistname. Therefore it couldn't find the artist! So now I just
>> look for 'rtist=' wh
Bouke Woudstra wrote:
It turned out that some flac files have tags like Artist=artistname and others
have artist=artistname. Therefore it couldn't find the artist! So now I just
look for 'rtist=' which works great.
You might want try using something like this:
wanted = set('artist album date
Thanks for all suggestions. Your first point I knew, but was too lazy to type
it. It made no difference for the test files had all tags. Knowing that it
was not a asynchrous thing helped me a lot though. There had to be something
wrong with the command line for metaflac.
It turned out that som
>
> The error thrown is: UnboundLocalError: local variable 'title' referenced
> before assignment
That should be pretty obvious: The UnboundLocalError comes up when you try
to access a variable that hasn't been assigned a value before. E.g try this
in an interactive python session:
foo = "hello"
On Tue, 22 Mar 2005 12:10:50 +0100, Bouke Woudstra
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm a bit stuck with this python script. It's aim is to encode all flac files
> to wav and then to mp3. The only problem I have is to preserve the tags. The
> code works when there's just one flac file in a dir
Hi,
I'm a bit stuck with this python script. It's aim is to encode all flac files
to wav and then to mp3. The only problem I have is to preserve the tags. The
code works when there's just one flac file in a directory but fails for more.
I can't see why the for loop fails here (flactags).
The
43 matches
Mail list logo