Martin Häcker added the comment:
Well, if that's the case, then this bug indeed can be closed. You switched from
list as the base type to set and that has to be dealt with on application side.
Still this is surprising, but there's not much that can be done
Martin Häcker added the comment:
Sorry, I got the title wrong on the first try. (Already corrected).
I think the problem is that the API of dict.keys() is surprising. One gets back
something that behaves like a list, the name 'keys' suggests that it is a list
and for lists
New submission from Martin Häcker:
I was quite surprised by this behavior:
dict() in [dict()]
True
dict() in []
False
dict() in dict(foo='bar').keys()
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: unhashable type: 'dict'
dict() in list(dict(foo='bar').keys
Changes by Martin Häcker spamfaen...@gmx.de:
--
title: dict() in dict(foo='bar') raises - dict() in dict(foo='bar').keys()
raises
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20190
Martin Häcker spamfaen...@gmx.de added the comment:
Jup - oh the joys of writing code in a bugtracker :)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13804
Martin Häcker spamfaen...@gmx.de added the comment:
@stutzbach: I believe you got me wrong, as the example topic.questions is meant
to return a list of questions that need concatenating - thus you can't save the
second step.
--
___
Python tracker
New submission from Martin Häcker spamfaen...@gmx.de:
Code that uses higher order methods is often the clearest description of what
you want to do. However since the higher order methods in python (filter, map,
reduce) are free functions and aren't available on collection classes as
methods
New submission from Martin Häcker spamfaen...@gmx.de:
[].sort() returns None which means you can't chain it.
So for example someDict.keys().sort()[0] doesn't work but you have to use
sorted(someDict.keys())[0] instead which is harder to read as you have to read
the line not from the beginning
Martin Häcker spamfaen...@gmx.de added the comment:
It really should return self.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13805
Martin Häcker spamfaen...@gmx.de added the comment:
Yes - however it has the same problem as the higher order version in the python
libraries that to read it you need to constantly jump back and forth in the
line.
--
___
Python tracker rep
New submission from Martin Häcker spamfaen...@gmx.de:
When looking at a regex with dir() you don't get all available attributes -
which is inconvenient as some very important ones (like .pattern) are not
visible.
To demonstrate:
import re
re.compile('foo').pattern
'foo'
dir(re.compile
Martin Häcker spamfaen...@gmx.de added the comment:
Indeed, I'm on version
% python --version
Python 2.7.1
Sorry.
--
status: pending - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13599
New submission from Martin Häcker spamfaen...@gmx.de:
When calling repr() on a compiled regex pattern like this:
import re
repr(re.compile('foo'))
you don't get the pattern of the regex out of the compiled form. Also all my
research has shown no getter to allow this.
I noticed this in my
Hi there,
I just tried to run this code and failed miserably - though I dunno why.
Could any of you please enlighten me why this doesn't work?
Thanks a bunch.
--- snip ---
import unittest
from datetime import datetime
class time (datetime):
def __init__(self, hours=0, minutes=0, seconds=0,
Ah, right. The light turns on...
datetime is immutable so overriding the constructor doesn't change the
constructed object. You have to override __new__ instead.
http://www.python.org/2.2.1/descrintro.html#__new__
Ahhh! Thanks a bunch, now this makes things much clearer.
Thanks again!
cu Martin
15 matches
Mail list logo