"as" keyword woes

2008-12-03 Thread Warren DeLano
A bottom line / pragmatic question... hopefully not a FAQ. Why was it necessary to make "as" a reserved keyword? And more to the point, why was it necessary to prevent developers from being able to refer to attributes named "as"? For example, this code breaks as of 2.6 / 3.0: Class C:

Re: "as" keyword woes

2008-12-03 Thread Warren DeLano
> Because it can be used at the import statement to let the imported thing > be known under another name? > Something like: > > >>> import xml.etree.ElementTree as ET Yes, but that syntax worked fine for years without "as" actually having to be a keyword. There must be something more going on h

"as" keyword woes

2008-12-03 Thread Warren DeLano
> > Why was it necessary to make "as" a reserved keyword? > > I can't answer for the Python developers as to why they *did* make it > a reserved word. > > But I can offer what I believe is a good reason why it *should* be a > reserved word: Because simple is better than complex, and special > cas

Re: "as" keyword woes

2008-12-04 Thread Warren DeLano
> I don't know how you infer any of those from what I said, nor > from the process of introducing features in Python. None of > what you say there rings at all true with anything I've > experienced in Python's core or the attitudes surrounding > development if the language; indeed, quite the o

"as" keyword woes

2008-12-04 Thread Warren DeLano
> Now, instead of keeping that special status, it was decided to make > it a reserved word since there's a new use case in Python 2.6 for > it as well - catching exceptions: > > >>> try: > ... 1/0 > ... except Exception as exc_object: > ... print exc_object > ... > integer division or modu

To Troll or Not To Troll

2008-12-04 Thread Warren DeLano
> Yet Another Python Troll (the ivory tower reference, as well as the > abrupt shift from complaining about keywords to multiprocessing), I > have to point out that Python does add new keywords, it has done so in > the past, and there was a considerable amount of warning, including an > automated d

RE: To Troll or Not To Troll

2008-12-04 Thread Warren DeLano
> I still would have to call your management of the problem considerably > into question - your expertise at writing mathematical software may > not be in question, but your skills and producing and managing a > software product are. You have nobody at your organization, which > sells a product tha

"as" keyword woes

2008-12-04 Thread Warren DeLano
> I still have not > >> seen a single post from you even hinting that you might have any > >> responsibility in the matter. > > > > Well then, let me set the record straight on that one point: > > > > I admit that it was entirely my mistake (and mine alone) to implicitly > > assume, by adopting suc

Re: To Troll or Not To Troll (aka: "as" keyword woes)

2008-12-04 Thread Warren DeLano
> From: Ben Finney <[EMAIL PROTECTED]> > > "Chris Mellon" <[EMAIL PROTECTED]> writes: > > > Peculiarities in usenet resulted in this discussion having several > > threads and I missed some messages before I wrote this email. > > I'll put this more bluntly: Warren's messages to date > egregious

Re: "as" keyword woes

2008-12-06 Thread Warren DeLano
> Date: Fri, 05 Dec 2008 22:22:38 -0800 > From: Dennis Lee Bieber <[EMAIL PROTECTED]> > Subject: Re: "as" keyword woes > To: python-list@python.org > Message-ID: <[EMAIL PROTECTED]> > > I'm still in the dark as to what type of data could > even inspire the > use of "as" as an object name.

Re: "as" keyword woes

2008-12-06 Thread Warren DeLano
> Date: Sat, 6 Dec 2008 12:13:16 -0800 (PST) > From: Carl Banks <[EMAIL PROTECTED]> > Subject: Re: "as" keyword woes > To: python-list@python.org > Message-ID: > > (snip) > > If you write a PEP, I advise you to try to sound less whiny and than > you have in this thread. > > (snip) Ehem, w

Safe eval of insecure strings containing Python data structures?

2008-10-08 Thread Warren DeLano
I would like to parse arbitrary insecure text string containing nested Python data structures in eval-compatible form: # For example, given a "config.txt" such as: { 'my_atom' : 1.20, 'my_dict' : { 2:50 , 'hi':'mom'}, 'my_list' : [ (1,2,3), [4.5,6.9], 'foo', 0 ] } # I would like to do

RE: Safe eval of insecure strings containing Python data structures?

2008-10-08 Thread Warren DeLano
JSON rocks! Thanks everyone. Ben wrote: >More generally, you should never execute (via eval, exec, or whatever) >*any* instruction from an untrusted path; especially not arbitrary >data from an input stream. Wow, for the record, I completely disagree with this point of view: Today's web apps

RE: Python-list Digest, Vol 61, Issue 368

2008-10-24 Thread Warren DeLano
> From: "Andy O'Meara" <[EMAIL PROTECTED]> > Unfortunately, a shared address region doesn't work when you have > large and opaque objects (e.g. a rendered CoreVideo movie in the > QuickTime API or 300 megs of audio data that just went through a > DSP). Then you've got the hit of serialization if