Clean Singleton Docstrings

Chris Angelico rosuav at gmail.com
Sun Jul 17 04:44:35 EDT 2016


On Sun, Jul 17, 2016 at 6:08 PM, Random832 <random832 at fastmail.com> wrote:
> On Sun, Jul 17, 2016, at 03:51, Chris Angelico wrote:
>> Currently yes, you can choose to use fractions.Fraction and pay the
>> price. How, if you have a single type with different representations,
>> can you make that choice?
>
> Sorry, I forgot to answer your question. Though, your implicit claim
> that it's impossible to make choices if your choices aren't represented
> by different types is absurd.
>
> For example, you could have a function that returns an inexact number
> with the (approximately) same value as the given number.

Which inexact type, though? Do you get decimal.Decimal, float, or
something else? How do you make that choice? And it's a critical
choice to make. They're not just "inexact numbers". You can have an
exact float (eg 7/2) or an inexact one, and same with Decimal.

ChrisA



More information about the Python-list mailing list