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
>
On Sep 9, 2008, at 9:34 PM, Mike Hansen wrote:
> 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 =
On Sep 10, 2008, at 7:35 AM, Jason Grout wrote:
> 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 try
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
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;
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
s
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.
>>
>> Anyon
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
>> pers
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("
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 beli
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
> decid
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
--~--~-~--~---
12 matches
Mail list logo