[issue20190] dict() in dict(foo='bar').keys() raises

2014-01-11 Thread Martin Häcker
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

[issue20190] dict() in dict(foo='bar').keys() raises

2014-01-09 Thread Martin Häcker
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

[issue20190] dict() in dict(foo='bar') raises

2014-01-08 Thread Martin Häcker
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

[issue20190] dict() in dict(foo='bar').keys() raises

2014-01-08 Thread Martin Häcker
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

[issue13804] Python library structure creates hard to read code when using higher order functions

2012-01-19 Thread Martin Häcker
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

[issue13804] Python library structure creates hard to read code when using higher order functions

2012-01-18 Thread Martin Häcker
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

[issue13804] Python library structure creates hard to read code when using higher order functions

2012-01-17 Thread Martin Häcker
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

[issue13805] [].sort() should return self

2012-01-17 Thread Martin Häcker
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

[issue13805] [].sort() should return self

2012-01-17 Thread Martin Häcker
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

[issue13804] Python library structure creates hard to read code when using higher order functions

2012-01-17 Thread Martin Häcker
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

[issue13599] Compiled regexes don't show all attributes in dir()

2011-12-14 Thread Martin Häcker
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

[issue13599] Compiled regexes don't show all attributes in dir()

2011-12-14 Thread Martin Häcker
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

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Martin Häcker
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

Overloading ctor doesn't work?

2005-01-20 Thread Martin Häcker
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,

Re: Overloading ctor doesn't work?

2005-01-20 Thread Martin Häcker
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