Author rhettinger
Recipients barry, eric.smith, ezio.melotti, mrabarnett, rhettinger, serhiy.storchaka
Date 2015-06-15.15:36:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> but may be implementing access via attributes would 
> be even better? mo.groupnamespace().col or mo.ns.col?

The whole point is to eliminate the unnecessary extra level.
Contrast using DOM with using ElementTree.  The difference
in usability and readability is huge.  If you do much in the
way of regex work, this will be a win:

   mo['name'], mo['rank'], mo['serialnumber']

There are several problems with trying to turn this into attribute access.  One of the usual ones are the conflict between the user fieldnames and the actual methods and attributes of the objects (that is why named tuples have the irritating leading underscore for its own attributes and methods).  The other problem is that it interferes with usability when the fieldname is stored in a variable.   Contrast, "fieldname='rank'; print(mo[fieldname])" with "fieldname='rank'; print(getattr(mo, fieldname))".

I'm happy to abandon the "len(mo)" suggestion, but mo[groupname] would be really nice.
Date User Action Args
2015-06-15 15:36:54rhettingersetrecipients: + rhettinger, barry, eric.smith, ezio.melotti, mrabarnett, serhiy.storchaka
2015-06-15 15:36:54rhettingersetmessageid: <>
2015-06-15 15:36:54rhettingerlinkissue24454 messages
2015-06-15 15:36:53rhettingercreate