En Sat, 09 Jan 2010 13:11:28 -0300, Victor Subervi
escribió:
Hi;
I have a string.join statement on a variable that comes from a
cgi.FieldStorage().getlist. The variable may be a list or a single
value. I
need to treat it differently depending on which it is. How can I
distinguish
it? len
On Mon, Jan 11, 2010 at 10:00 AM, Jean-Michel Pichavant <
jeanmic...@sequans.com> wrote:
> Victor Subervi wrote:
>
> On Sat, Jan 9, 2010 at 11:56 AM, Gary Herron
> > gher...@islandtraining.com>> wrote:
>>
>>Victor Subervi wrote:
>>
>>Hi;
>>I have a string.join statement on a
Victor Subervi wrote:
On Sat, Jan 9, 2010 at 11:56 AM, Gary Herron
mailto:gher...@islandtraining.com>> wrote:
Victor Subervi wrote:
Hi;
I have a string.join statement on a variable that comes from a
cgi.FieldStorage().getlist. The variable may be a list or a
On Sat, Jan 9, 2010 at 11:56 AM, Gary Herron wrote:
> Victor Subervi wrote:
>
>> Hi;
>> I have a string.join statement on a variable that comes from a
>> cgi.FieldStorage().getlist. The variable may be a list or a single value. I
>> need to treat it differently depending on which it is. How can I
Victor Subervi wrote:
Hi;
I have a string.join statement on a variable that comes from a
cgi.FieldStorage().getlist. The variable may be a list or a single value. I
need to treat it differently depending on which it is. How can I distinguish
it? len(var) will obviously give me the length of the s
Victor Subervi wrote:
Hi;
I have a string.join statement on a variable that comes from a
cgi.FieldStorage().getlist. The variable may be a list or a single
value. I need to treat it differently depending on which it is. How
can I distinguish it? len(var) will obviously give me the length of
t
Victor Subervi wrote:
Hi;
I have a string.join statement on a variable that comes from a
cgi.FieldStorage().getlist. The variable may be a list or a single
value. I need to treat it differently depending on which it is. How can
I distinguish it? len(var) will obviously give me the length of th
Hi;
I have a string.join statement on a variable that comes from a
cgi.FieldStorage().getlist. The variable may be a list or a single value. I
need to treat it differently depending on which it is. How can I distinguish
it? len(var) will obviously give me the length of the string if it's a
string a
Erik Johnson wrote:
>As an aside, I notice a lot of other people's interpreters actually
> print 'True' or 'False' where my system prints 0 or 1. Is that a
> configuration that can easily set somewhere?
$ python2.1 -c "print 1 == 1"
1
$ python2.2 -c "print 1 == 1"
1
$ python2.3 -c "print 1
Erik Johnson wrote:
Steven Bethard <[EMAIL PROTECTED]> wrote:
py> class A:
... pass
...
py> class B:
... pass
...
py> a = A()
py> a.__class__ == A
True
py> a.__class__ == B
False
"Just" <[EMAIL PROTECTED]> wrote
Uh, isinstance(a, A) works for both new-style and old-style classes.
Heck, is
> Steven Bethard <[EMAIL PROTECTED]> wrote:
> > py> class A:
> > ... pass
> > ...
> > py> class B:
> > ... pass
> > ...
> > py> a = A()
> > py> a.__class__ == A
> > True
> > py> a.__class__ == B
> > False
"Just" <[EMAIL PROTECTED]> wrote
> Uh, isinstance(a, A) works for both new-style
Just wrote:
In article <[EMAIL PROTECTED]>,
Steven Bethard <[EMAIL PROTECTED]> wrote:
py> class A:
... pass
...
py> class B:
... pass
...
py> a = A()
py> a.__class__ == A
True
py> a.__class__ == B
False
Uh, isinstance(a, A) works for both new-style and old-style classes.
Heck, isinstance(
In article <[EMAIL PROTECTED]>,
Steven Bethard <[EMAIL PROTECTED]> wrote:
> Erik Johnson wrote:
> > "Erick" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >
> >>Ah, you're running into the "old-style classes vs. new style classes".
> >>Try subclassing from "object".
> >>
> >>F
Erik Johnson wrote:
"Erick" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Ah, you're running into the "old-style classes vs. new style classes".
Try subclassing from "object".
For example:
class A(object):
That works! :) I guess I am fortunate to be running 2.2 - looks kinda ugly
prio
"Erick" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Ah, you're running into the "old-style classes vs. new style classes".
> Try subclassing from "object".
>
> For example:
>
> >>> class A(object):
That works! :) I guess I am fortunate to be running 2.2 - looks kinda ugly
prior
Ah, you're running into the "old-style classes vs. new style classes".
Try subclassing from "object".
For example:
>>> class A(object):
... pass
...
>>> a=A()
>>> type(a)
>>> type(a) == A
True
>>> type(a) is A
True
>>> b=A()
>>> type(a) == type(b)
True
>>> type(a) is type(b)
True
Check out t
Ah, you're running into the "old-style classes vs. new style classes".
Try subclassing from "object".
For example:
>>> class A(object):
... pass
...
>>> a=A()
>>> type(a)
>>> type(a) == A
True
>>> type(a) is A
True
>>> b=A()
>>> type(a) == type(b)
True
>>> type(a) is type(b)
True
Check out t
On Erik Johnson wrote:
> # The following "works", but I don't want to keep a set of instances to
> compare against
> >>> obj2 = A()
> >>> type(obj) == type(obj2)
> 1
How about:
>>> class A:
pass
>>> class B:
pass
>>> objA = A()
>>> type( objA ) == type( A() )
True
then again
I quickly browsed through section 9 of the Tutorial, tried some simple
Google searches: I'm not readily seeing how to test class type. Given some
object (might be an instance of a user-created class, might be None, might
be list, might be some other "standard" type object instance), how do yo
19 matches
Mail list logo