Nick wrote:
Just one comment. It seems like it would be better just to make add_method inline, since everything else in __init__ is, and it never gets called from anywhere else.

add_method?

But it looks good and probably fairly optimal. I personally like to see properties instead of __getattr__ for known attributes, but that's a style preference.

I also like properties, but doesn't that cause a problem if someone chooses to subclass FieldStorage?

Jim


Nick

Mike Looijmans wrote:

How about we make the first call to get or __getitem__ create the dictionary? We could put code in __getattr__ to create it when it's referenced.



Here is the patch to util.py to use a dictionary-on-demand.
Lots of code removed for this one, and a few lines added.

There's also a brand new items() function, which, contrary to common belief, preserves argument ordering.

Note: This also includes my previous StringField patch, since that is crucial to make the implementation as simple as it is now.

Anxiously awaiting your comments and benchmark/profiler results!

['Lies', 'Damn lies', 'Statistics', 'Delivery dates', 'Benchmarks']

Reply via email to