Re: Inheriting from OrderedDict causes problem

2012-02-22 Thread Bruce Eckel
On Feb 22, 10:10 am, Peter Otten <__pete...@web.de> wrote: > Looks like invoking OrderedDict.__init__() is necessary: > > >>> from collections import OrderedDict > >>> class X(OrderedDict): > > ...     def __init__(self, stuff): > ...             super(X, self).__init__() > ...             for k, v

Inheriting from OrderedDict causes problem

2012-02-22 Thread Bruce Eckel
Notice that both classes are identical, except that one inherits from dict (and works) and the other inherits from OrderedDict and fails. Has anyone seen this before? Thanks. import collections class Y(dict): def __init__(self, stuff): for k, v in stuff: self[k] = v # Thi

Re: Python code file prototype

2012-02-17 Thread Bruce Eckel
>         Of course, since the OP was talking Windows... the #! line is > ignored no matter where it was Yes, but I use Windows, Mac and Linux so I'm searching for something universal. -- http://mail.python.org/mailman/listinfo/python-list

Python code file prototype

2012-02-17 Thread Bruce Eckel
I finally figured out how to set up the Windows explorer's right-click "new" so that it will create Python files. Here's how: http://superuser.com/questions/34704/windows-7-add-an-item-to-new-context-menu There's an option when you do this to insert default file contents, so I began searching the

Re: Automatic Type Conversion to String

2012-02-15 Thread Bruce Eckel
> Could it be that you missed the fact that strings are immutable? That > means that you can't change the content of the object once it is > initialized. In particular, it means that you e.g. have to override > __new__ instead of __init__, because the content is already fixed when > the latter is c

Re: Automatic Type Conversion to String

2012-02-13 Thread Bruce Eckel
I'm willing to subclass str, but when I tried it before it became a little confusing -- I think mostly because anytime I assigned to self it seemed like it converted the whole object to a str rather than a Path. I suspect I don't know the proper idiom for doing this -- any hints? Thanks ... --

Automatic Type Conversion to String

2012-02-13 Thread Bruce Eckel
oes this path exist? So you can say "if path:" """ return bool(os.path.exists(self.path)) """ Nose tests. To run, you must first install nose: pip install nose Then: nosetests path.py """ def test_platform(): "

Re: Pycon disappointment

2008-03-16 Thread Bruce Eckel
On Mar 16, 2:48 pm, Pete Forde <[EMAIL PROTECTED]> wrote: > My friends and I decided to stage a grassroots Ruby conference this > summer; it will have no paid sponsors for exactly this reason. We're > trying to change up the typical format as well: it's a single-track > event, no "keynotes", no sch

Pycon disappointment

2008-03-16 Thread Bruce Eckel
If the following seems unnecessarily harsh, it was even more harsh for me to discover that the time and money I had spent to get to my favorite conference had been sold to vendors, presenting me as a captive audience they could pitch to. I believe that this year's Pycon organizers suffered from in