Message335189
+1 from me. We're already made regular expression match objects less opaque and that has been useful. There's no need for a python-ideas discussion for this.
If a repr doesn't round-trip, we generally put it angle brackets (see PEP 8):
>>> re.search(r'([a-z]+)(\d*)', 'alpha7')
<re.Match object; span=(0, 6), match='alpha7'>
The Row object access style uses square brackets and has a keys() method. That suggests a dict-like representation would be intuitive and match how Row objects are used: ro['salary'] and ro.keys().
Putting those two ideas together we get:
<sqlite3.Row object; {'name': 'John', 'salary': 42}>
Note the OP's suggestion for keyword argument style doesn't make sense for two reasons: 1) Row objects don't allow attribute access (i.e. ro.name is invalid) and 2) the field names are not required to be valid Python identifiers (i.e. ro['class'] is possible but ro.class is syntactically invalid because "class" is a keyword). |
|
Date |
User |
Action |
Args |
2019-02-11 02:30:07 | rhettinger | set | recipients:
+ rhettinger, terry.reedy, ghaering, vlad |
2019-02-11 02:30:05 | rhettinger | set | messageid: <1549852205.41.0.72198454056.issue35889@roundup.psfhosted.org> |
2019-02-11 02:30:05 | rhettinger | link | issue35889 messages |
2019-02-11 02:30:05 | rhettinger | create | |
|