On Sun, Oct 25, 2009 at 12:51 AM, Noufal Ibrahim wrote:
> This was quite remarkable. I enjoyed the whole thing very much. I had
> to leave a little early so couldn't get the whole of the zfs demo. At
> what time did you guys leave?
>
We left at 8:30, I think. The real presentation stuff got over
This was quite remarkable. I enjoyed the whole thing very much. I had
to leave a little early so couldn't get the whole of the zfs demo. At
what time did you guys leave?
--
~noufal
http://nibrahim.net.in
___
BangPypers mailing list
BangPypers@python.or
Just to add - Doubt is cleared.
Thanks all !!
--Bhaskar.
On Sat, Oct 24, 2009 at 11:49 PM, bhaskar jain
wrote:
> >>>On Sat, Oct 24, 2009 at 5:09 PM, Sidharth Kuruvila <
> sidharth.kuruv...@gmail.com> wrote:
> >>>So do a lot of hard thinking before you say something is broken.
>
> I have never q
>>>On Sat, Oct 24, 2009 at 5:09 PM, Sidharth Kuruvila <
sidharth.kuruv...@gmail.com> wrote:
>>>So do a lot of hard thinking before you say something is broken.
I have never questioned the correctness, rather wanted to clear my doubt.
>>> d = {'a':1, 'b':2, 'c':3}
>>> id(d.keys())
404296
>>> d
Hi,
The sort method doesn't return anything. It modifies the list which
you call it on.
l = d.keys()
l.sort() #There is no point assigning the return value to this because
it will be None
#Which is what you do when you write l = d.keys().sort()
print l
Now there is another subtle issue here wi
On Sat, Oct 24, 2009 at 4:49 PM, bhaskar jain wrote:
> Thanks all for replying.
>
> Let me be clear,
>
> [..snip..]
>
>
> Now if we have, d = {'a':1, 'b':2}
> >>> l = d.keys().sort()
> >>> print l
> None
>
>
> d.keys() is a list which references the keys of the dictionary.
> But the sort method d
Thanks all for replying.
Let me be clear,
>>> l = [2,1]
>>> id(l[0])
8402300
>>> id(l[1])
8402312
>>> l.sort()
>>> id(l[0])
8402312
>>> id(l[1])
8402300
So if we had [l] --> [0] -> 2
[1] -> 1
after the sort, the index [0] binds to the '1'
On Sat, Oct 24, 2009 at 3:35 PM, Sidharth Kuruvila
wrote:
> Hi Anand.
>
>> Looks like Python dictionary implementation is doing something clever.
>> d.keys() returns the cached object if its refcount == 1 and returns a
>> new object if refcount > 1.
>>
>
> I don't think that's what's happening
>
>
Hi Anand.
> Looks like Python dictionary implementation is doing something clever.
> d.keys() returns the cached object if its refcount == 1 and returns a
> new object if refcount > 1.
>
I don't think that's what's happening
>>> id(d.keys())
535168
>>> id(d.keys())
535168
>>> l = [1,2,3,4]
>>> i
Hi,
One more thing, the dict in python is a hash map so the keys won't be
ordered. If you want an ordered set of keys you could consider storing
the keys in a separate ordered list. You could also consider building
a binary tree based dict but that would be a pain.
Also a quick search brought up
> Can sort not modify read-only location.
>
d
> {'a': 1, 'c': 3, 'b': 2}
>
id(d)
> 412816
>
id(d.keys())
> 404296
I see why you thought d.keys() is read-only. Multiple calls to
d.keys() seems to be returning the same object.
>>> d = {'a': 1, 'c': 3, 'b': 2}
>>> id(d)
200112
>>> id
Hi,
>>> d = {"a":1, "b":2}
>>> d.keys()
['a', 'b']
>>> a = d.keys()
>>> b = d.keys()
>>> id(a)
542120
>>> id(b)
542200
So d creates a new list with each call to keys.
The behavior might be different in python 3 where I hear d.keys() will
return a set
Regards,
Sidharth
On Sat, Oct 24, 2009 at 2
On Sat, Oct 24, 2009 at 1:32 PM, bhaskar jain
wrote:
> Hello,
>
> Can sort not modify read-only location.
>
d
> {'a': 1, 'c': 3, 'b': 2}
>
id(d)
> 412816
>
id(d.keys())
> 404296
>
type(d.keys())
>
>
print d.keys().sort()
The sort method of a list doesn't return a sorted
On Sat, Oct 24, 2009 at 1:32 PM, bhaskar jain wrote:
> Hello,
>
> Can sort not modify read-only location.
>
> >>> d
> {'a': 1, 'c': 3, 'b': 2}
>
> >>> id(d)
> 412816
>
> >>> id(d.keys())
> 404296
>
> >>> type(d.keys())
>
>
> >>> print d.keys().sort()
> None
>
>
> We can so sorted(d.keys()) and i
Hello,
Can sort not modify read-only location.
>>> d
{'a': 1, 'c': 3, 'b': 2}
>>> id(d)
412816
>>> id(d.keys())
404296
>>> type(d.keys())
>>> print d.keys().sort()
None
We can so sorted(d.keys()) and it works but was just wondering whether sort
which modifies in-place fails when the loca
15 matches
Mail list logo