Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-07 Thread Paul Moore
On 7 February 2018 at 05:36, Alex Walters wrote: > While this thread has focused on the location and means of managing py.ini, > I think there is a more general solution that should be considered to the > original problem, as described. The problem isn't that it's difficult or > non-obvious how t

Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-07 Thread Alex Walters
> -Original Message- > From: Paul Moore [mailto:p.f.mo...@gmail.com] > Sent: Wednesday, February 7, 2018 4:15 AM > To: Alex Walters > Cc: Steve Barnes ; Python-Ideas id...@python.org> > Subject: Re: [Python-ideas] Possible Enhancement to py Launcher - set > default > ... > > IMO the b

[Python-ideas] importlib: making FileFinder easier to extend

2018-02-07 Thread Erik Bray
Hello, Brief problem statement: Let's say I have a custom file type (say, with extension .foo) and these .foo files are included in a package (along with other Python modules with standard extensions like .py and .so), and I want to make these .foo files importable like any other module. On its f

Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-07 Thread Paul Moore
I don't think so. As an example, what registry keys would Anaconda write to say that Release 5.2.1.7 is a pre-release version? Or would the py launcher have to parse the version looking for rc/a/b/... tags? And distributions would have to agree on how they record pre-release version numbers? Paul

Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-07 Thread Steve Dower
Checking the Version (!=SysVersion) property should be enough (and perhaps we need to set it properly on install). The launcher currently only works with PythonCore entries anyway, so no need to worry about other distros. PEP 514 allows for other keys to be added as well (it specifies a minimum

[Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Neil Girdhar
Arbitrary radix comes up every now and then and Decimal already has a radix() method. It would be nice when initializing a Decimal object to be able to specify an arbitrary radix>=2. ___ Python-ideas mailing list Python-ideas@python.org https://mail.py

Re: [Python-ideas] Complicate str methods

2018-02-07 Thread Neil Girdhar
On Saturday, February 3, 2018 at 8:10:38 PM UTC-5, Steven D'Aprano wrote: > > On Sun, Feb 04, 2018 at 10:54:53AM +1100, Chris Angelico wrote: > > > Picking up this one as an example, but this applies to all of them: > > the transformation you're giving here is dangerously flawed. If there > >

[Python-ideas] Consider making Decimal's context use PEP 567

2018-02-07 Thread Neil Girdhar
Decimal could just pull its Context object from a context variable rather than having to pass it in to all functions. This would be similar to how numpy works. ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listin

Re: [Python-ideas] Complicate str methods

2018-02-07 Thread Mike Miller
+1 I have the need for one or two of these in every project (of a certain size) and have to come up with solutions each time with the re module or a loop. Not a fan of regex's for trivial tasks, or those that require a real parser. On 2018-02-03 14:04, Franklin? Lee wrote: __

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Chris Angelico
On Thu, Feb 8, 2018 at 8:49 AM, Neil Girdhar wrote: > Arbitrary radix comes up every now and then and Decimal already has a > radix() method. It would be nice when initializing a Decimal object to be > able to specify an arbitrary radix>=2. > The radix method always returns 10, because decimal.D

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Neil Girdhar
I wanted to have something like a binary floating point number like 0.11011. Ideally, it would be as simple as Decimal('0.11011', radix=2). Best, Neil On Wed, Feb 7, 2018 at 5:02 PM Chris Angelico wrote: > On Thu, Feb 8, 2018 at 8:49 AM, Neil Girdhar > wrote: > > Arbitrary radix comes up eve

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Neil Girdhar
Oh, and to answer your specific question, I want to change the way arithmetic is done. I want it to be done in a different radix. On Wed, Feb 7, 2018 at 5:07 PM Neil Girdhar wrote: > I wanted to have something like a binary floating point number like > 0.11011. Ideally, it would be as simple a

Re: [Python-ideas] Complicate str methods

2018-02-07 Thread Serhiy Storchaka
04.02.18 00:04, Franklin? Lee пише: Let s be a str. I propose to allow these existing str methods to take params in new forms. s.replace(old, new):     Allow passing in a collection of olds.     Allow passing in a single argument, a mapping of olds to news.     Allow the olds in the mapping

Re: [Python-ideas] Consider making Decimal's context use PEP 567

2018-02-07 Thread Nathaniel Smith
On Feb 7, 2018 1:54 PM, "Neil Girdhar" wrote: Decimal could just pull its Context object from a context variable rather than having to pass it in to all functions. This would be similar to how numpy works. Decimal has always used a thread local context the same way numpy does, and in 3.7 it's

Re: [Python-ideas] Consider making Decimal's context use PEP 567

2018-02-07 Thread Neil Girdhar
Wow, that's awesome! I didn't notice that when I checked. It seemed like context had to be passed in. If it were me, I would probably deprecate those context=None arguments now that we have such a clean solution. On Wed, Feb 7, 2018 at 5:32 PM Nathaniel Smith wrote: > On Feb 7, 2018 1:54 PM,

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Steven D'Aprano
On Wed, Feb 07, 2018 at 10:08:50PM +, Neil Girdhar wrote: > Oh, and to answer your specific question, I want to change the way > arithmetic is done. I want it to be done in a different radix. Why? There are clear advantages to floating point arithmetic done in base 2 (speed, minimum possib

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Neil Girdhar
On Wed, Feb 7, 2018 at 5:52 PM Steven D'Aprano wrote: > On Wed, Feb 07, 2018 at 10:08:50PM +, Neil Girdhar wrote: > > > Oh, and to answer your specific question, I want to change the way > > arithmetic is done. I want it to be done in a different radix. > > Why? > > There are clear advantage

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Chris Angelico
On Thu, Feb 8, 2018 at 10:08 AM, Neil Girdhar wrote: > > On Wed, Feb 7, 2018 at 5:52 PM Steven D'Aprano wrote: >> >> - slower; >> - larger errors when converting from decimal numbers (in general); >> - larger rounding errors; >> - larger wobble; > > > I don't see why it would have any of those pr

Re: [Python-ideas] Possible Enhancement to py Launcher - set default

2018-02-07 Thread Paul Moore
On 7 February 2018 at 19:35, Steve Dower wrote: > Checking the Version (!=SysVersion) property should be enough (and perhaps > we need to set it properly on install). The launcher currently only works > with PythonCore entries anyway, so no need to worry about other distros. Fair enough. But ther

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Neil Girdhar
On Wed, Feb 7, 2018 at 6:36 PM Chris Angelico wrote: > On Thu, Feb 8, 2018 at 10:08 AM, Neil Girdhar > wrote: > > > > On Wed, Feb 7, 2018 at 5:52 PM Steven D'Aprano > wrote: > >> > >> - slower; > >> - larger errors when converting from decimal numbers (in general); > >> - larger rounding errors

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Chris Angelico
On Thu, Feb 8, 2018 at 10:49 AM, Neil Girdhar wrote: >> > Right, I was playing with this problem >> > >> > (https://brilliant.org/weekly-problems/2017-10-02/advanced/?problem=no-computer-needed) >> > and wanted to work in base 2. I realize it's niche, but it's not >> > exactly a >> > significant

Re: [Python-ideas] Consider making Decimal's context use PEP 567

2018-02-07 Thread Nick Coghlan
On 8 February 2018 at 08:36, Neil Girdhar wrote: > Wow, that's awesome! I didn't notice that when I checked. It seemed like > context had to be passed in. If it were me, I would probably deprecate > those context=None arguments now that we have such a clean solution. The context=None feature i

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Case Van Horsen
On Wed, Feb 7, 2018 at 3:49 PM, Neil Girdhar wrote: > On Wed, Feb 7, 2018 at 6:36 PM Chris Angelico wrote: >> You should be able to use the native float type for binary >> floating-point. But the whole point of that challenge is that you >> shouldn't need a computer. > > > Yeah, I know, but I wan

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Steven D'Aprano
On Wed, Feb 07, 2018 at 11:49:27PM +, Neil Girdhar wrote: > I see your list was about converting to and from base 10. That wasn't > really intended in my proposal. I meant wholly working in another base. > In that sense, 10 isn't particularly "fast, error-free, better at rounding, > etc." I

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Terry Reedy
On 2/7/2018 6:08 PM, Neil Girdhar wrote: On Wed, Feb 7, 2018 at 5:52 PM Steven D'Aprano > wrote: On Wed, Feb 07, 2018 at 10:08:50PM +, Neil Girdhar wrote: > Oh, and to answer your specific question, I want to change the way > arithmetic is done. 

Re: [Python-ideas] Consider generalizing Decimal to support arbitrary radix

2018-02-07 Thread Neil Girdhar
That's really cool! I never knew about gmpy. On Wed, Feb 7, 2018 at 7:10 PM Case Van Horsen wrote: > On Wed, Feb 7, 2018 at 3:49 PM, Neil Girdhar > wrote: > > On Wed, Feb 7, 2018 at 6:36 PM Chris Angelico wrote: > >> You should be able to use the native float type for binary > >> floating-poi