Re: [Python-ideas] Is it Python 3 yet?
Hmm, agreed. BTW, I think the current download page is *way* too complicated for new comers. There should be a giant button for the latest 3.x/64 (platform sniffed), and below it a more subtle button for the "LTS" 2.X/32. The rest of the choices and text should be pushed to another page marked "advanced," including the PGP (boggle) section. The Licenses through History section could be moved to About. -Mike On 2017-01-26 08:11, Victor Stinner wrote: The download button of https://www.python.org/ currently gives the ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
Re: [Python-ideas] Using Python for end user applications
On Sat, Jan 28, 2017 at 5:26 AM, Paul Moorewrote: > On 28 January 2017 at 02:11, C Anthony Risinger wrote: > > I can't articulate it we'll, or even fully isolate the reasons for it. > All I > > really know is how I feel when peers ask me about Python or the reading I > > get when others speak about their experience using it. Python is > absolutely > > one of my favorite languages to write, yet I find myself recommending > > against it, and watching others do the same. Python comes with caveats > and > > detailed explanations out the gate and people simply perceive higher > > barriers and more chores. > > Picking up on this and the comment you made in the original post > > > With a still difficult distribution/compatibility story, I've watched > dozens of instances > > where people choose something else, usually Node or Golang. > > Can you explain why you recommend against Python, in a bit more > detail? If you are an enthusiastic Python user, but you are steering > people away from Python, then it would be worth understanding why. > > As you mention end user applications and distribution, one of my first > questions would be what platform you work on. Following on from that, > what sort of end user applications are you looking at? If we're > talking here about games for iOS, then that's a much different > situation than GUI apps for Windows or command line tools for Linux. > I'm working on Linux myself, with my typical audience being other developers or occasionally leadership. Builds usually include Windows, but always Linux and OSX. I'd like a one-click solution to: How do I redistribute and successfully install Python, dependencies, and an application with the least possible steps for the end user? For any platform or persona? I prefer dynamic applications redistribute their runtime, and not depend on the system in any significant way aside from major libraries or support files. It's more obnoxious sometimes but I believe it lowers the number of unexpected incidents. I also don't want to setup support infrastructure (pypi proxy cache or self hosted pypi) myself or require coordination with ops teams. Simple authenticated download for publishing is ideal, and direct execution of that download is even better. Containers are have greatly impacted how people think about distribution. There is a trend to use fast/small containers as CLI tools. I think there is still benefit to empowering a way to "remix python" with your local environment and produce a redistributable binary for downstream users. I have far less experience with Go but I like how easy it is to generate such executables. My personal feeling is that Python happily works in the "Command line > tools for Linux" area (except possibly with regard to C extensions > where the plethora of Linux ABIs makes things hard). But other areas > less so. I've been having good experiences making standalone > applications with the new Windows "embedded" distributions, but that > is relatively new, and still has a lot of rough edges. I'm working on > a project to bundle a working zipapp with the embedded distribution to > make a standalone exe - would having something like that make any > difference in your environment? > Yes I believe it would. I implemented something to this end for Linux (defunct, no Python 3, uses abandoned PEP 425): https://github.com/anthonyrisinger/zippy about 4-5 years ago for this purpose, before similar technologies such as PEX and zipapp existed. It worked well for the time it was used. The project is dead, but it had a few ideas I think might be worth further exploration. In a nutshell, "zippy" was a build tool (waf and distlib because no interface to pip) that always output a single python binary built from source. All python code (stdlib, deps, app) was appended in a zipfile. All C-extensions (including dotted) were observed during .so generation and re-linked statically into the binary as builtins instead (more on this below). The end result was a self-contained executable that would only recognize it's own stdlib and could properly run embedded C-modules. The implementation also changed entrypoints based on argv[0], so this could thing could perform as a multicall binary like BusyBox (the symlink name was resolved to an entrypoint). It was easy to send this to other developers where they could unpack it for development or use it as-is. A future goal was to allow respinning an unpacked environment into a new redistributable. To make this work, I changed python in a few specific ways: Set LANDMARK file at build time to something other than `os.py`. Python uses this file to recognize the stdlib during early boot. Customizing it [zippy-SOMEHASH.json] ensures a different unpacked build's stdlib is unrecognizable (this happens *often* if you've "installed" a build by unpacking to the default path, then do another build). Add `sys.executable` to the default search path. This ensures
Re: [Python-ideas] math.nextafter
On 07.02.2017 00:46, Steven D'Aprano wrote: > On Mon, Feb 06, 2017 at 11:29:17AM +0100, M.-A. Lemburg wrote: > >> I'm not sure how useful this would be in the stdlib, >> since it's very much tied to whatever float type Python >> happens to use on a platform. > > With the possible exception of µPy, are there any Python implementations > which don't use a C double as float? (I'm not sure what you mean with "µPy") By far most implementations will use IEEE 754 64-bit doubles: https://en.wikipedia.org/wiki/Double-precision_floating-point_format MicroPython also supports single precision float configurations or no floats at all (depends on the availability of an FPU). What I wanted to say with the above comment is that Python itself does not make guarantees on how floats are represented internally (in CPython it's a C double, which only has minimum requirements). In theory, it would be possible to have a Python implementation using e.g. binary128 floats or MPFR (http://www.mpfr.org/). You are right in saying that this is a rather unlikely case :-) However, using the internal representation of floats to define a "valid" interval for roots doesn't sound like a good concept. Those intervals will depend on where the roots are. Close to 0, the intervals will be very small, near the outer range limits, very large: https://blogs.msdn.microsoft.com/dwayneneed/2010/05/06/fun-with-floating-point/ I guess there is some use in trying to determine the error intervals of calculations, though. Perhaps that's the main intent of those functions. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Feb 07 2017) >>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ >>> Python Database Interfaces ... http://products.egenix.com/ >>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ http://www.malemburg.com/ ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
Re: [Python-ideas] math.nextafter
On Mon, Feb 06, 2017 at 11:29:17AM +0100, M.-A. Lemburg wrote: > I'm not sure how useful this would be in the stdlib, > since it's very much tied to whatever float type Python > happens to use on a platform. With the possible exception of µPy, are there any Python implementations which don't use a C double as float? -- Steve ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
Re: [Python-ideas] math.nextafter
Do you mean something like: isclose(f(x), 0.0, rel_tol, abs_tol) If so, what should `rel_tol` and `abs_tol` be? On Mon, Feb 6, 2017 at 2:16 PM, M.-A. Lemburgwrote: > On 06.02.2017 13:22, Juraj Sukop wrote: > > On Mon, Feb 6, 2017 at 11:29 AM, M.-A. Lemburg wrote: > > > >> > >> Juraj: Could you provide some use cases, where such a function > >> would help in Python applications ? (I can see use cases > >> written in C, but due to the low level, find it hard to > >> believe that people would use this at the Python level) > >> > > > > In my case, `nextafter` would be used to check if a number is close to > > polynomial zero, e.g.: > > > > def f(x): > > return 2.0*x**3 - 3.0*x**2 + 5.0*x - 7.0 > > > > # x = 1.4455284586795218 > > x = 1.445528458679522 > > # x = 1.4455284586795223 > > # x = 1.4455284586795225 > > > > left = nextafter(x, -float('inf')) > > right = nextafter(x, float('inf')) > > > > print((f(left) < 0.0) != (f(x) < 0.0) or (f(x) < 0.0) != (f(right) < > > 0.0)) > > Isn't this something you can do with math.isclose() ? > > This would even give you a predefined error range, > not a dynamic one. > > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the Experts (#1, Feb 06 2017) > >>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ > >>> Python Database Interfaces ... http://products.egenix.com/ > >>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ > > > ::: We implement business ideas - efficiently in both time and costs ::: > >eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 > D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg >Registered at Amtsgericht Duesseldorf: HRB 46611 >http://www.egenix.com/company/contact/ > http://www.malemburg.com/ > > ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
Re: [Python-ideas] math.nextafter
On 06.02.2017 13:22, Juraj Sukop wrote: > On Mon, Feb 6, 2017 at 11:29 AM, M.-A. Lemburgwrote: > >> >> Juraj: Could you provide some use cases, where such a function >> would help in Python applications ? (I can see use cases >> written in C, but due to the low level, find it hard to >> believe that people would use this at the Python level) >> > > In my case, `nextafter` would be used to check if a number is close to > polynomial zero, e.g.: > > def f(x): > return 2.0*x**3 - 3.0*x**2 + 5.0*x - 7.0 > > # x = 1.4455284586795218 > x = 1.445528458679522 > # x = 1.4455284586795223 > # x = 1.4455284586795225 > > left = nextafter(x, -float('inf')) > right = nextafter(x, float('inf')) > > print((f(left) < 0.0) != (f(x) < 0.0) or (f(x) < 0.0) != (f(right) < > 0.0)) Isn't this something you can do with math.isclose() ? This would even give you a predefined error range, not a dynamic one. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Feb 06 2017) >>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ >>> Python Database Interfaces ... http://products.egenix.com/ >>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ http://www.malemburg.com/ ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
Re: [Python-ideas] math.nextafter
On Mon, Feb 6, 2017 at 11:29 AM, M.-A. Lemburgwrote: > > Juraj: Could you provide some use cases, where such a function > would help in Python applications ? (I can see use cases > written in C, but due to the low level, find it hard to > believe that people would use this at the Python level) > In my case, `nextafter` would be used to check if a number is close to polynomial zero, e.g.: def f(x): return 2.0*x**3 - 3.0*x**2 + 5.0*x - 7.0 # x = 1.4455284586795218 x = 1.445528458679522 # x = 1.4455284586795223 # x = 1.4455284586795225 left = nextafter(x, -float('inf')) right = nextafter(x, float('inf')) print((f(left) < 0.0) != (f(x) < 0.0) or (f(x) < 0.0) != (f(right) < 0.0)) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
Re: [Python-ideas] math.nextafter
On 04.02.2017 12:59, Stephan Houben wrote: > Hi all, > > Visual C++ 2015 supports this one: > > https://msdn.microsoft.com/en-us/library/h0dff77w.aspx > > In any case, this is easy to implement an efficient fallback in C, unlike > the fma() function we discussed some time ago. > > To put this in a bit wider perspective: would it be useful to investigate > how much of the C99 math library could > be supported in Python in general? +1 from me for those features which can be emulated for platforms which don't have the math lib function available and are not too esoteric (though many of those have already been added), e.g. cbt() may be useful. Now, with respect to the one mentioned in the subject, I'm not sure how useful this would be in the stdlib, since it's very much tied to whatever float type Python happens to use on a platform. Juraj: Could you provide some use cases, where such a function would help in Python applications ? (I can see use cases written in C, but due to the low level, find it hard to believe that people would use this at the Python level) Thanks, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Feb 06 2017) >>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ >>> Python Database Interfaces ... http://products.egenix.com/ >>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ http://www.malemburg.com/ ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/