On Mon, 11 Feb 2008 10:41:44 -0500, Steve Holden wrote:
> If the "type" variable really is a type, of course, then the real
> solution is hardly radical: stop using the names of types and start
> using the types:
[snip example using "type(obj) in (type1, type2)"]
But if you're using actual type
Bruno Desthuilliers wrote:
> Paul Rubin a écrit :
>>> ki lo wrote:
I have type variable which may have been set to 'D' or 'E'
Now, which one of following statements are more efficient
if type =='D' or type == 'E':
or
if re.search("D|E", type):
Steven D'Aprano:
bearophile:
> > The new string search done by Effbot is really good :-)
> Care to explain what "new string search" you're referring to? Inquiring
> minds want to know.
I meant this good work you can find in Python 2.5:
http://effbot.org/zone/stringlib.htm
Bye,
bearophile
--
http
Paul Rubin a écrit :
>> ki lo wrote:
>>> I have type variable which may have been set to 'D' or 'E'
>>>
>>> Now, which one of following statements are more efficient
>>>
>>> if type =='D' or type == 'E':
>>>
>>> or
>>>
>>> if re.search("D|E", type):
>>>
>>> Please let me know because the function i
> ki lo wrote:
> > I have type variable which may have been set to 'D' or 'E'
> >
> > Now, which one of following statements are more efficient
> >
> > if type =='D' or type == 'E':
> >
> > or
> >
> > if re.search("D|E", type):
> >
> > Please let me know because the function is going to called
ki lo wrote:
> I have type variable which may have been set to 'D' or 'E'
>
> Now, which one of following statements are more efficient
>
> if type =='D' or type == 'E':
>
> or
>
> if re.search("D|E", type):
>
> Please let me know because the function is going to called 10s of millions
> of ti
On Sat, 09 Feb 2008 02:08:15 -0800, bearophileHUGS wrote:
> The new string search done by Effbot is really good :-)
Care to explain what "new string search" you're referring to? Inquiring
minds want to know.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
Michael Spencer:
> # perhaps faster
> $ python -mtimeit -s"t='D'" "if t in 'DE': pass"
> 100 loops, best of 3: 0.204 usec per loop
That may be faster indeed, but it gives true if t is "DE" too, and
that may be bad.
The new string search done by Effbot is really good :-)
Bye,
bearophile
--
ht
En Fri, 08 Feb 2008 22:45:06 -0200, ki lo <[EMAIL PROTECTED]> escribió:
> I have type variable which may have been set to 'D' or 'E'
>
> Now, which one of following statements are more efficient
>
> if type =='D' or type == 'E':
>
> or
>
> if re.search("D|E", type):
>
> Please let me know because
ki lo wrote:
> I have type variable which may have been set to 'D' or 'E'
>
> Now, which one of following statements are more efficient
>
> if type =='D' or type == 'E':
>
> or
>
> if re.search("D|E", type):
>
> Please let me know because the function is going to called 10s of
> millions of t
ki lo wrote:
> I have type variable which may have been set to 'D' or 'E'
>
> Now, which one of following statements are more efficient
>
> if type =='D' or type == 'E':
>
> or
>
> if re.search("D|E", type):
>
> Please let me know because the function is going to called 10s of
> millions of times.
I have type variable which may have been set to 'D' or 'E'
Now, which one of following statements are more efficient
if type =='D' or type == 'E':
or
if re.search("D|E", type):
Please let me know because the function is going to called 10s of millions
of times.
Thanks
Kilo
--
http://mail.pyt
12 matches
Mail list logo