Hi, Mike,
On Sep 9, 2008, at 9:34 PM, Mike Hansen wrote:
What's the difference between == and is (or, more to the point:
where is this discussed)?
This is a Python thing as == is equality testing and is is memory
address testing. For example,
sage: a = 2
sage: b = 2
sage: a == b
True
Justin Walker wrote:
On Sep 9, 2008, at 7:25 PM, Jason Grout wrote:
Jason Merrill wrote:
On Sep 9, 6:35 pm, Justin Walker [EMAIL PROTECTED] wrote:
Hi, all,
There may be a more pythonic way to do this--I'm just trying to
translate something I saw in Ruby. I think I've seen at least one
Hi Justin,
I'm not sure about the other stuff, but you should do is None
instead of == None since your times are so low.
sage: a = 2
sage: timeit(a == None)
625 loops, best of 3: 420 µs per loop
sage: timeit(a is None)
625 loops, best of 3: 143 ns per loop
--Mike
On Sep 9, 6:35 pm, Justin Walker [EMAIL PROTECTED] wrote:
Hi, all,
Whilst looking at some code, I noticed that a computation was being
repeated on each call, although the inputs to the computation never
changed (these were values used to define an instance of a class). I
decided to
Jason Merrill wrote:
On Sep 9, 6:35 pm, Justin Walker [EMAIL PROTECTED] wrote:
Hi, all,
There may be a more pythonic way to do this--I'm just trying to
translate something I saw in Ruby. I think I've seen at least one
person define an @cache decorator somewhere on the web.
I believe we
Hey, Mike,
Thanks for this...
On Sep 9, 2008, at 3:42 PM, Mike Hansen wrote:
I'm not sure about the other stuff, but you should do is None
instead of == None since your times are so low.
sage: a = 2
sage: timeit(a == None)
625 loops, best of 3: 420 µs per loop
sage: timeit(a is None)
On Sep 9, 2008, at 7:25 PM, Jason Grout wrote:
Jason Merrill wrote:
On Sep 9, 6:35 pm, Justin Walker [EMAIL PROTECTED] wrote:
Hi, all,
There may be a more pythonic way to do this--I'm just trying to
translate something I saw in Ruby. I think I've seen at least one
person define an
On Sep 9, 2008, at 4:36 PM, Jason Merrill wrote:
On Sep 9, 6:35 pm, Justin Walker [EMAIL PROTECTED] wrote:
[snip]
I can't tell if this is just an artifact of some funky debugging
interaction (am I debugging the debugger?), or whether this is really
where the code goes.
Anyone have a clue
Hi Justin,
What's the difference between == and is (or, more to the point:
where is this discussed)?
This is a Python thing as == is equality testing and is is memory
address testing. For example,
sage: a = 2
sage: b = 2
sage: a == b
True
sage: id(a)
54737440
sage: id(b)
54735856
sage: a is
Hi, Mike,
On Sep 9, 2008, at 9:34 PM, Mike Hansen wrote:
What's the difference between == and is (or, more to the point:
where is this discussed)?
This is a Python thing as == is equality testing and is is memory
address testing. For example,
Thanks for the quick tutorial; that explains
10 matches
Mail list logo