Re: Clean Singleton Docstrings

2016-07-17 Thread Steven D'Aprano
On Sun, 17 Jul 2016 06:03 pm, Random832 wrote: > On Sun, Jul 17, 2016, at 03:51, Chris Angelico wrote: >> > True, although the programmer has control over the feature. If you >> > *want* the luxury of exact fractions, you pay the price. If you don't, >> > you make the numbers inexact. >> >> Not i

Re: Clean Singleton Docstrings

2016-07-17 Thread Chris Angelico
On Sun, Jul 17, 2016 at 6:08 PM, Random832 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

Re: Clean Singleton Docstrings

2016-07-17 Thread Random832
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

Re: Clean Singleton Docstrings

2016-07-17 Thread Random832
On Sun, Jul 17, 2016, at 03:51, Chris Angelico wrote: > > True, although the programmer has control over the feature. If you > > *want* the luxury of exact fractions, you pay the price. If you don't, > > you make the numbers inexact. > > Not if you have a single "Number" type: Saying that exact a

Re: Clean Singleton Docstrings

2016-07-17 Thread Chris Angelico
On Sun, Jul 17, 2016 at 5:41 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> The trouble is, repeated addition of fractions is *able* to deliver an >> exact result. It just might result in an incredibly slow program. > > True, although the programmer has control over the feature. If you > *want*

Re: Clean Singleton Docstrings

2016-07-17 Thread Marko Rauhamaa
Chris Angelico : > The trouble is, repeated addition of fractions is *able* to deliver an > exact result. It just might result in an incredibly slow program. True, although the programmer has control over the feature. If you *want* the luxury of exact fractions, you pay the price. If you don't, y

Re: Clean Singleton Docstrings

2016-07-16 Thread Chris Angelico
On Sun, Jul 17, 2016 at 7:27 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> In that case, an 'Exact' non-integer will have appalling performance - >> fractions.Fraction doesn't really work all that nicely when the >> numbers start getting huge. > > In Scheme, any math operation is allowed to dr

Re: Clean Singleton Docstrings

2016-07-16 Thread Marko Rauhamaa
Chris Angelico : > In that case, an 'Exact' non-integer will have appalling performance - > fractions.Fraction doesn't really work all that nicely when the > numbers start getting huge. In Scheme, any math operation is allowed to drop exactness: If one of these procedures is unable to deliver

Re: Clean Singleton Docstrings

2016-07-16 Thread Chris Angelico
On Sun, Jul 17, 2016 at 4:04 AM, Random832 wrote: > On Sat, Jul 16, 2016, at 03:27, Chris Angelico wrote: >> Will an "Exact" non-integer be stored as Decimal or >> Fraction? How do you know? They have vastly different semantics, and >> you should be able to choose. > > Er, the point is for them to

Re: Clean Singleton Docstrings

2016-07-16 Thread Marko Rauhamaa
Random832 : > On Sat, Jul 16, 2016, at 03:27, Chris Angelico wrote: >> Will an "Exact" non-integer be stored as Decimal or >> Fraction? How do you know? They have vastly different semantics, and >> you should be able to choose. > > Er, the point is for them to _not_ have different semantics. A dec

Re: Clean Singleton Docstrings

2016-07-16 Thread Random832
On Sat, Jul 16, 2016, at 03:27, Chris Angelico wrote: > Will an "Exact" non-integer be stored as Decimal or > Fraction? How do you know? They have vastly different semantics, and > you should be able to choose. Er, the point is for them to _not_ have different semantics. A decimal storage format w

Re: Clean Singleton Docstrings

2016-07-16 Thread Steven D'Aprano
Oh, and a further thought... On Sat, 16 Jul 2016 04:53 pm, Random832 wrote: > Eliminate both of them. Move to a single abstract numeric type* a la > Scheme, with an "inexact" attribute (inexact numbers may or may not be > represented by a float, or by the same bigint/decimal/rational types as >

Re: Clean Singleton Docstrings

2016-07-16 Thread Steven D'Aprano
On Sat, 16 Jul 2016 04:53 pm, Random832 wrote: > On Sat, Jul 16, 2016, at 02:29, Chris Angelico wrote: >> The difference between ints and floats can lead to bugs, too. Which >> one should we eliminate? > > Eliminate both of them. Move to a single abstract numeric type* a la > Scheme, with an "ine

Re: Clean Singleton Docstrings

2016-07-16 Thread Marko Rauhamaa
Chris Angelico : > With a single abstract numeric type, what exactly does "inexact" mean, > where does it come from, and how does that affect the expected > behaviour and performance of numbers? Not much is said in the standard: Thus inexactness is a contagious property of a number. If two

Re: Clean Singleton Docstrings

2016-07-16 Thread Chris Angelico
On Sat, Jul 16, 2016 at 4:53 PM, Random832 wrote: > On Sat, Jul 16, 2016, at 02:29, Chris Angelico wrote: >> The difference between ints and floats can lead to bugs, too. Which >> one should we eliminate? > > Eliminate both of them. Move to a single abstract numeric type* a la > Scheme, with an "i

Re: Clean Singleton Docstrings

2016-07-16 Thread Random832
On Sat, Jul 16, 2016, at 02:29, Chris Angelico wrote: > The difference between ints and floats can lead to bugs, too. Which > one should we eliminate? Eliminate both of them. Move to a single abstract numeric type* a la Scheme, with an "inexact" attribute (inexact numbers may or may not be represe

Re: Clean Singleton Docstrings

2016-07-15 Thread Chris Angelico
On Sat, Jul 16, 2016 at 4:19 PM, Lawrence D’Oliveiro wrote: > On Saturday, July 16, 2016 at 4:20:13 PM UTC+12, Ethan Furman wrote: >> >> On 07/15/2016 09:04 PM, Rustom Mody wrote: >> >>> Just that suggesting that python's bool notion is straightforward is an >>> unnecessary lie – especially to new

Re: Clean Singleton Docstrings

2016-07-15 Thread Lawrence D’Oliveiro
On Saturday, July 16, 2016 at 4:20:13 PM UTC+12, Ethan Furman wrote: > > On 07/15/2016 09:04 PM, Rustom Mody wrote: > >> Just that suggesting that python's bool notion is straightforward is an >> unnecessary lie – especially to newbies. > > Python's boolean concept is as simple as it gets -- what

Re: Clean Singleton Docstrings

2016-07-15 Thread Rustom Mody
On Saturday, July 16, 2016 at 9:50:13 AM UTC+5:30, Ethan Furman wrote: > On 07/15/2016 09:04 PM, Rustom Mody wrote: > > > Just that suggesting that python's bool notion is straightforward is an > > unnecessary lie – especially to newbies. > > Python's boolean concept is as simple as it gets -- wh

Re: Clean Singleton Docstrings

2016-07-15 Thread Ethan Furman
On 07/15/2016 09:04 PM, Rustom Mody wrote: Just that suggesting that python's bool notion is straightforward is an unnecessary lie – especially to newbies. Python's boolean concept is as simple as it gets -- what is not straightforward about it? -- ~Ethan~ -- https://mail.python.org/mailman/

Re: Clean Singleton Docstrings

2016-07-15 Thread Rustom Mody
On Thursday, July 14, 2016 at 5:24:50 AM UTC+5:30, Peter Otten wrote: > Lawrence D’Oliveiro wrote: > > And there are still those who think that Python’s lax acceptance of > > non-boolean values as booleans is a good idea... > > I don't think this particular problem serves as an argument for strict

Re: Clean Singleton Docstrings

2016-07-13 Thread Ian Kelly
On Wed, Jul 13, 2016 at 5:54 PM, Peter Otten <[email protected]> wrote: > Lawrence D’Oliveiro wrote: > >> On Friday, July 8, 2016 at 7:38:56 PM UTC+12, Peter Otten wrote: >> >>> There is a test >>> >>> if not object: >>> raise ImportError('no Python documentation found for %r' % thing) >>> >>> i

Re: Clean Singleton Docstrings

2016-07-13 Thread Peter Otten
Lawrence D’Oliveiro wrote: > On Friday, July 8, 2016 at 7:38:56 PM UTC+12, Peter Otten wrote: > >> There is a test >> >> if not object: >> raise ImportError('no Python documentation found for %r' % thing) >> >> in the pydoc module. So all you need is to ensure that your Registry >> evaluate

Re: Clean Singleton Docstrings

2016-07-13 Thread Lawrence D’Oliveiro
On Friday, July 8, 2016 at 7:38:56 PM UTC+12, Peter Otten wrote: > There is a test > > if not object: > raise ImportError('no Python documentation found for %r' % thing) > > in the pydoc module. So all you need is to ensure that your Registry > evaluates to True in a boolean context, e. g.

Re: Clean Singleton Docstrings

2016-07-08 Thread Ethan Furman
On 07/08/2016 09:57 AM, Rob Gaddi wrote: Michael Selik wrote: On Jul 7, 2016, at 7:46 PM, Rob Gaddi wrote: I've got a package that contains a global ensmartened dict that allows all the various parts of my program to share state. The simplest solution would be to use a module as your singl

Re: Clean Singleton Docstrings

2016-07-08 Thread Rob Gaddi
Michael Selik wrote: > > >> On Jul 7, 2016, at 7:46 PM, Rob Gaddi >> wrote: >> >> I've got a package that contains a global ensmartened dict that allows >> all the various parts of my program to share state. > > The simplest solution would be to use a module as your singleton. For > example, "

Re: Clean Singleton Docstrings

2016-07-08 Thread Rob Gaddi
Steven D'Aprano wrote: > On Fri, 8 Jul 2016 05:38 pm, Peter Otten wrote: > > [...] >>> Is this a thing that can be fixed with a commensurate amount of effort? >> >> There is a test >> >> if not object: >> raise ImportError('no Python documentation found for %r' % thing) >> >> in the pydoc m

Re: Clean Singleton Docstrings

2016-07-08 Thread Steven D'Aprano
On Fri, 8 Jul 2016 05:38 pm, Peter Otten wrote: [...] >> Is this a thing that can be fixed with a commensurate amount of effort? > > There is a test > > if not object: > raise ImportError('no Python documentation found for %r' % thing) > > in the pydoc module. So all you need is to ensure t

Re: Clean Singleton Docstrings

2016-07-08 Thread Rustom Mody
On Friday, July 8, 2016 at 1:15:04 PM UTC+5:30, Peter Otten wrote [slightly edited] > Peter Otten wrote: > > > You might also file a bug report asking to replace > > if not object: ... > > > > with > > > >if object is None: ... > > I take that back; the problem is fixed in Python 3.5. Hoo boy!

Re: Clean Singleton Docstrings

2016-07-08 Thread Peter Otten
Peter Otten wrote: > You might also file a bug report asking to replace I take that back; the problem is fixed in Python 3.5. -- https://mail.python.org/mailman/listinfo/python-list

Re: Clean Singleton Docstrings

2016-07-08 Thread Peter Otten
Rob Gaddi wrote: > I've got a package that contains a global ensmartened dict that allows > all the various parts of my program to share state. Things like device > handles, information about the application environment, etc. that are > inherantly global (i.e. we're not having that debate). > >

Re: Clean Singleton Docstrings

2016-07-07 Thread Michael Selik
> On Jul 7, 2016, at 7:46 PM, Rob Gaddi > wrote: > > I've got a package that contains a global ensmartened dict that allows > all the various parts of my program to share state. The simplest solution would be to use a module as your singleton. For example, "registry.py" would work. Pydoc wil

Re: Clean Singleton Docstrings

2016-07-07 Thread Steven D'Aprano
On Fri, 8 Jul 2016 09:46 am, Rob Gaddi wrote: [...] > So Registry is now a globally accessible mutable object; no reason to > complicate things with singletons or borgs or whathave you. From > within the interactive console, help(foobar.Registry) gives me the > _Registry documentation as expected.