Re: ConfigParser preserving file ordering

2007-10-19 Thread Andrew Durdin
On 10/19/07, Frank Aune [EMAIL PROTECTED] wrote: Yes, but as I said I need functionality present in the standard-library, so sub-classing ConfigParser is the last option really. Any particular reason you're limited to the standard library? I've used iniparse http://code.google.com/p/iniparse/

Re: Inheriting automatic attributes initializer considered harmful?

2007-10-18 Thread Andrew Durdin
On 10/17/07, Alex Martelli [EMAIL PROTECTED] wrote: fake_str is not called, because special-method lookup occurs on the TYPE, *NOT* on the instance. So it does; I'd forgotten that. I need to remember to actually check that the code does what I think it does before posting it on c.l.p :-|

Re: Automatically organize module imports

2007-10-17 Thread Andrew Durdin
On 10/15/07, Jean-Paul Calderone [EMAIL PROTECTED] wrote: Pyflakes will tell you which imports aren't being used (among other things). I don't know if an existing tool which will automatically rewrite your source, though. I'll second that recommendation of Pyflakes -- as the interpreter only

Re: Inheriting automatic attributes initializer considered harmful?

2007-10-17 Thread Andrew Durdin
On 10/17/07, Thomas Wittek [EMAIL PROTECTED] wrote: Writing such constructors for all classes is very tedious. So I subclass them from this base class to avoid writing these constructors: class AutoInitAttributes(object): def __init__(self, **kwargs): for k, v in

Re: EasyMock for python ?

2007-10-15 Thread Andrew Durdin
On 10/12/07, Ben Finney [EMAIL PROTECTED] wrote: I've had good results with Ian Bicking's 'minimock.py' URL:http://blog.ianbicking.org/minimock.html. It uses the existing 'doctest' functionality for its output, and a minimock.Mock will mock *everything* (using further Mock instances for

Re: Unexpected behaviour with HTMLParser...

2007-10-10 Thread Andrew Durdin
On 10/9/07, Just Another Victim of the Ambient Morality [EMAIL PROTECTED] wrote: Diez B. Roggisch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Without code, that's hard to determine. But you are aware of e.g. handle_entityref(name) handle_charref(ref) ?

Re: Override 'and' and 'or'

2007-10-08 Thread Andrew Durdin
On 10/7/07, Dekker [EMAIL PROTECTED] wrote: Well I think it is not possible what I wanted to achieve. By overriding the and and or keyword I wanted to return a new object: SqlValueInt(4) and SqlValueInt(5) -- SqlOpAnd(SqlValueInt(4), SqlValueInt(5)) PEP 335 is a proposal to allow overriding

Re: sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread Andrew Durdin
On 9/25/07, Mark Summerfield [EMAIL PROTECTED] wrote: Since the sorteddict's data is always kept in key order, indexes (integer offsets) into the sorteddict make sense. Five additional methods are proposed to take advantage of this: key(index : int) - value item(index

Re: Confused about 'positive lookbehind assertion'

2007-09-25 Thread Andrew Durdin
On 9/25/07, Karthik Gurusamy [EMAIL PROTECTED] wrote: Any idea what this positive lookbehind achieves which can't be done without it. I remember cases where positive look-ahead is useful. In the above example, r.search('abcdef') does the job of ensuring 'def' is preceded by 'abc'. AFAICT

Re: Regex anomaly

2006-01-03 Thread Andrew Durdin
On 3 Jan 2006 02:20:52 -0800, Sam Pointon [EMAIL PROTECTED] wrote: Would this particular inconsistency be candidate for change in Py3k? Seems to me the pos and endpos arguments are redundant with slicing, Being able to specify the start and end indices for a search is important when working

Re: Humane programmer interfaces

2006-01-02 Thread Andrew Durdin
On 1/3/06, Alex Martelli [EMAIL PROTECTED] wrote: Dennis Lee Bieber [EMAIL PROTECTED] wrote: if somestr[:len(needle)] == needle: This is definitely more readable, and the same would apply if I tested somestr[:len('glab')] == 'glab' -- the key point being that one knows where that slice

Re: Regex anomaly

2006-01-02 Thread Andrew Durdin
On 2 Jan 2006 21:00:53 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Has anyone has issue with compiled re's vis-a-vis the re.I (ignore case) flag? I can't make sense of this compiled re producing a different match when given the flag, odd both in it's difference from the uncompiled

Re: Humane programmer interfaces

2005-12-29 Thread Andrew Durdin
On 29 Dec 2005 09:50:57 -0800, colinwb [EMAIL PROTECTED] wrote: puts ck.first, ck[0], '*', ck.last, ck[-1] One of the points at issue (minimalism/monotony) relates to TOOWTDI, which has implications for language/module design and for code readability. Ruby supports negative indices in the same

Re: Guido working on Pypy?

2005-12-29 Thread Andrew Durdin
On 29 Dec 2005 04:12:53 -0800, Luis M. González [EMAIL PROTECTED] wrote: According to this blog entry, it says that Guido has been hired by Google to work on Pypy: http://zephyrfalcon.org/weblog2/arch_e10_00870.html Is there anyone who can confirm this information? Luis Or deny it:

Re: python coding contest

2005-12-29 Thread Andrew Durdin
On 12/28/05, Shane Hathaway [EMAIL PROTECTED] wrote: I just found a 125 character solution. It's actually faster and more readable than the 133 character solution (though it's still obscure.) Having spent a good deal of time and effort, and not getting below 144 characters, I am now very eager

Re: Tricky Areas in Python

2005-10-23 Thread Andrew Durdin
On 10/24/05, Alex Martelli [EMAIL PROTECTED] wrote: I may branch out into more advanced stuff such as asking for an example use case for a closure, a custom descriptor, or an import hook, for example Isn't that approaching things from the wrong angle? You're asking them to synthesise a problem

Re: Defending Python

2005-07-13 Thread Andrew Durdin
On 7/13/05, Jorey Bump [EMAIL PROTECTED] wrote: Bruno Desthuilliers [EMAIL PROTECTED] wrote: The larch! IT'S A TREE ... not a shrubbery? -- http://mail.python.org/mailman/listinfo/python-list

Re: Lisp development with macros faster than Python development?..

2005-07-06 Thread Andrew Durdin
On 6 Jul 2005 00:30:34 -0700, Raymond Hettinger [EMAIL PROTECTED] wrote: With Lisp or Forth, a master programmer has unlimited power and expressiveness. With Python, even a regular guy can reach for the stars. +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: Speaking of list-comprehension?

2005-07-01 Thread Andrew Durdin
On 7/1/05, Chinook [EMAIL PROTECTED] wrote: Thank you Andrew, and your elaboration is well taken. I was just exploring here and the construct you noted is IMHO intuitively readable - at least for a simple expression and condition. Other than the choice order [False, True] which seems

Re: When someone from Britain speaks, Americans hear a Britishaccent...

2005-07-01 Thread Andrew Durdin
On 7/1/05, Grant Edwards [EMAIL PROTECTED] wrote: On 2005-06-30, Delaney, Timothy (Tim) [EMAIL PROTECTED] wrote: Tom Anderson wrote: How about carrier? Ends in an a (Australian ;) Right, but due to some wierd property requiring conservation of consonants, when speaking Strine you've

Re: Lost in a sea of documentation...can you point me in the right direction?

2005-06-30 Thread Andrew Durdin
On 30 Jun 2005 14:38:17 -0700, MooMaster [EMAIL PROTECTED] wrote: So I started reading about os, threads, and the path for the special folders in the archives and in the Python docs and I'm kind of lost because there aren't many concrete examples in the documentation. Can anyone point me in

Re: Which kid's beginners programming - Python or Forth?

2005-06-28 Thread Andrew Durdin
On 6/29/05, Rocco Moretti [EMAIL PROTECTED] wrote: Sorry, thought of one more thing Python has going for it vs. Forth - reference material. Check the catalog of your local library. I'd guess that there is more choice for Python programming books vs. Forth programming books. I just checked,

Re: case/switch statement?

2005-06-19 Thread Andrew Durdin
On 6/18/05, D H [EMAIL PROTECTED] wrote: I would hardly call using a dictionary as a switch statement, the equivalent. The fact that people use a dictionary as a conditional is a python wart. Not at all. A case statement is nothing more than a literal mapping of constant values to the