[Python-ideas] Dunder method to make object str-like
Random832
random832 at fastmail.com
Thu Apr 7 10:07:06 EDT 2016
More information about the Python-ideas mailing list
Thu Apr 7 10:07:06 EDT 2016
- Previous message (by thread): [Python-ideas] Dunder method to make object str-like
- Next message (by thread): [Python-ideas] Dunder method to make object str-like
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Apr 7, 2016, at 09:41, Paul Moore wrote: > On 7 April 2016 at 14:04, Chris Angelico <rosuav at gmail.com> wrote: > > Proposal: Objects should be allowed to declare that they are > > "string-like" by creating a dunder method (analogously to __index__ > > for integers) which implies a loss-less conversion to str. > > What would this be used for? Other than Path, what types would be > viable candidates for being "string like"? I can't think of a use case > for this feature. How about ASCII bytes strings? ;) > For that matter, what constitutes a "lossless conversion to str"? What's __index__ for?
- Previous message (by thread): [Python-ideas] Dunder method to make object str-like
- Next message (by thread): [Python-ideas] Dunder method to make object str-like
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list