Re: [Python-Dev] Default formatting

2017-01-22 Thread Ethan Furman
On 01/22/2017 11:48 AM, Serhiy Storchaka wrote: On 25.10.16 12:37, Serhiy Storchaka wrote: Classes that doesn't define the __format__ method for custom PEP 3101 formatting inherits it from parents. Originally the object.__format__ method was designed as [1]: def __format__(self, format_spe

Re: [Python-Dev] Default formatting

2017-01-22 Thread Serhiy Storchaka
On 25.10.16 12:37, Serhiy Storchaka wrote: Classes that doesn't define the __format__ method for custom PEP 3101 formatting inherits it from parents. Originally the object.__format__ method was designed as [1]: def __format__(self, format_spec): return format(str(self), format_spec)

Re: [Python-Dev] Default formatting

2016-10-27 Thread Serhiy Storchaka
On 27.10.16 19:59, Steve Dower wrote: Having the default __format__ behave like this makes me happiest: def __format__(self, fmt): return format(str(self), fmt) My 2c. YMMV. etc. See issue7994 [1] for arguments against this. [1] http://bugs.python.org/issue7994 __

Re: [Python-Dev] Default formatting

2016-10-27 Thread Steve Dower
On 27Oct2016 0251, Serhiy Storchaka wrote: On 27.10.16 02:44, Eric V. Smith wrote: But on the other hand, the existing behavior is well specified and has been around since object.__format__ was added. I'm not sure it needs changing. What's the harm in leaving it? More complicated code. And may

Re: [Python-Dev] Default formatting

2016-10-27 Thread Serhiy Storchaka
On 27.10.16 02:44, Eric V. Smith wrote: But on the other hand, the existing behavior is well specified and has been around since object.__format__ was added. I'm not sure it needs changing. What's the harm in leaving it? More complicated code. And maybe this behavior is less intuitive. It cont

Re: [Python-Dev] Default formatting

2016-10-26 Thread Eric V. Smith
On 10/25/2016 5:37 AM, Serhiy Storchaka wrote: Classes that doesn't define the __format__ method for custom PEP 3101 formatting inherits it from parents. Originally the object.__format__ method was designed as [1]: def __format__(self, format_spec): return format(str(self), format_s

[Python-Dev] Default formatting

2016-10-25 Thread Serhiy Storchaka
Classes that doesn't define the __format__ method for custom PEP 3101 formatting inherits it from parents. Originally the object.__format__ method was designed as [1]: def __format__(self, format_spec): return format(str(self), format_spec) An instance is converted to string and re