Re: [Python-ideas] Retire or reword the "Beautiful is better than ugly" Zen clause

2018-09-13 Thread Stephan Houben
Op do 13 sep. 2018 12:03 schreef Antoine Pitrou : > On Thu, 13 Sep 2018 11:55:40 +0200 > "Giampaolo Rodola'" > wrote: > > > > This is simply ridiculous. I'm not sure if this is political > > correctness pushed to its limits or just trolling. > > Indeed she might be trolling. Though the fact we'r

Re: [Python-ideas] Python dialect that compiles into python

2018-09-11 Thread Stephan Houben
Op di 11 sep. 2018 om 10:42 schreef Brice Parent : > Le 11/09/2018 à 02:15, Abe Dillon a écrit : > > [Steven D'Aprano] > >> It would be great for non-C coders to be able to prototype proposed >> syntax changes to get a feel for what works and what doesn't. > > > I think it would be great in genera

Re: [Python-ideas] Keyword only argument on function call

2018-09-11 Thread Stephan Houben
My 3 cents: 1. My most objective objection against the f(*, foo, bar, baz) syntax is that it looks like positional arguments, and the syntactic marker * which dissuades you of that can be arbitrarily far apart from the keyword. 2. The syntax f(=foo, =bar, =baz) at least solves that problem

[Python-ideas] Fwd: Add Unicode-aware str.reverse() function?

2018-09-08 Thread Stephan Houben
Op za 8 sep. 2018 13:33 schreef Paddy3118 : > > I would like to propose that Python add a Unicode-aware *str.reverse *method. > The problem is, I'm a Brit, who only speaks English and only very rarely > dips into Unicode.* I don't know how useful this would be!* > To be honest, quite apart from

Re: [Python-ideas] Executable space protection: NX bit,

2018-09-03 Thread Stephan Houben
I am pretty sure that on systems which support it, Python's stack and data are already NX. NX is basically the default on modern systems. Stephan Op ma 3 sep. 2018 09:00 schreef Wes Turner : > Rationale > = > - Separation of executable code and non-executable data is a good thing. > - A

Re: [Python-ideas] Fix some special cases in Fractions?

2018-08-30 Thread Stephan Houben
I would also like to point out that the current behavior of Fraction is consistent with other parts of the numeric system, e.g. 1/1 produces 1.0 (rather than 1) math.sqrt(4) produces 2.0 (rather than 2) 1j-1j produces 0j (rather than 0.0 or 0) So in general the type of the output is determined by

Re: [Python-ideas] Pre-conditions and post-conditions

2018-08-28 Thread Stephan Houben
I Op wo 29 aug. 2018 07:53 schreef Greg Ewing : > Wes Turner wrote: > > I'm going to re-write that in a pseudo-Eiffel like syntax: > > Maybe some magic could be done to make this work: > > def __init__(self, img: np.ndarray, x: int, y: int, width: int, > height: int) -> Non

Re: [Python-ideas] A GUI for beginners and experts alike

2018-08-24 Thread Stephan Houben
Op za 25 aug. 2018 02:28 schreef Chris Barker - NOAA Federal via Python-ideas : > > > Too bad all the cool kids are doing web dev these days — hard to get > help with a desktop GUI project :-( > Pywebview seems interesting, uses a platform webview to put up the UI; https://github.com/r0x0r/pywe

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-23 Thread Stephan Houben
Op do 23 aug. 2018 09:06 schreef Jacco van Dorp : > I think it would have been better to use def from the start instead of > lambda. The only thing JS does right is using the same "function" keyword > for both of these. > Seriously? Consider how the following code function f() { return 42; }

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-22 Thread Stephan Houben
Fwiw, I usually don't do def foo(): if False: yield None But simply: def foo(): return () That the returned iterable is not a generator seldom matters. Stephan Op wo 22 aug. 2018 21:17 schreef Chris Angelico : > On Thu, Aug 23, 2018 at 3:56 AM, Rhodri James > wrote: > > On 22/08/18 1

Re: [Python-ideas] Does jargon make learning more difficult?

2018-08-22 Thread Stephan Houben
Op wo 22 aug. 2018 18:40 schreef Steven D'Aprano : > Chris' conclusion is that anonymous functions are inherently hard for > many beginners to learn, regardless of whether the syntax is called > "lambda" or "function". > Civilization itself had trouble with the concept. Functions as mathematical

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-22 Thread Stephan Houben
Let me stand up and say that I personally like lambda. It's the standard terminology and not easily confused. I doubt that "many Python users" have a problem with it. Evidence? I dislike the def proposal strongly. It is too similar to a normal def. At least get a new keyword then Some other lang

Re: [Python-ideas] Revisiting dedicated overloadable boolean operators

2018-08-04 Thread Stephan Houben
I use these Vim abbreviations, which are derived from LaTeX https://gist.github.com/stephanh42/fc466e62bfb022a890ff2c4643eaf3a5 Stephan Op za 4 aug. 2018 20:03 schreef David Mertz : > On Sat, Aug 4, 2018, 1:24 PM Steven D'Aprano wrote: > >> If you think the uproar over PEP 572 was vicious, ima

Re: [Python-ideas] PEP 505: None-aware operators

2018-08-01 Thread Stephan Houben
Op wo 1 aug. 2018 11:10 schreef Jonathan Fine : > > > You're right to be cautious. My understanding of PEP 505 is that > #13. a ?. b ?. __str__ > #14. (a ?. b) ?. __str__ > are not equivalent. The first is None, and the other is None.__str__. > That looks like a gotcha. > No. None.?__str__ prod

Re: [Python-ideas] PEP 505: None-aware operators

2018-08-01 Thread Stephan Houben
Op wo 1 aug. 2018 10:50 schreef Chris Angelico : > On Wed, Aug 1, 2018 at 6:45 PM, Jonathan Fine wrote: > > Hi Chris > > > > Thank you for your reply. I think we're making good progress. > > > > You wrote > > > >>> 10) a ?. b ?. c > >>> 11) (a ?. b) ?. c > >> > >> I would parse those differently,

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-31 Thread Stephan Houben
Op di 31 jul. 2018 20:49 schreef Jonathan Fine : > David Mertz wrote: > > > `spam?.eggs?.cheese?.aardvark` is NOT redundant for > > `spam?.eggs.cheese.aardvark`. The two expressions simply do different > > things [...] > > I agree, assuming ?. is a binary operator. It isn't. Given this, in Py

Re: [Python-ideas] Redefining method

2018-07-30 Thread Stephan Houben
Here is an example of how it could be done. https://gist.github.com/stephanh42/97b47506e5e416f97f5790c070be7878 Stephan Op di 31 jul. 2018 01:29 schreef Steven D'Aprano : > On Tue, Jul 31, 2018 at 10:10:32AM +1200, Greg Ewing wrote: > > Jamesie Pic wrote: > > >def o.bar(self): ... > > > > You

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-19 Thread Stephan Houben
Let me just address this point: 2018-07-19 20:36 GMT+02:00 Brendan Barnwell : > As far as I can see, these null-coalescing operators would break > that model. The PEP doesn't seem to provide for a "real" magic method > allowing users to override the actual behavior of the method. (You c

Re: [Python-ideas] Performance improvements via static typing

2018-07-19 Thread Stephan Houben
You are aware of numba? https://numba.pydata.org/ Stephan Op do 19 jul. 2018 16:03 schreef Eric Fahlgren : > On Thu, Jul 19, 2018 at 6:52 AM Michael Hall > wrote: > >> While I am aware of projects like Cython and mypy, it seems to make sense >> for CPython to allow optional enforcement of type

Re: [Python-ideas] PEP 505: None-aware operators

2018-07-19 Thread Stephan Houben
FWIW, I like ?? It is short and distinctive. There is prior art in this spelling in c#. It requires no new keyword, nor does it give new meaning to an existing one. I understand why ?[ needs to be spelled using only a single ?, but I am afraid it will be used infrequently, and people will accide

Re: [Python-ideas] The future of Python parallelism. The GIL. Subinterpreters. Actors.

2018-07-19 Thread Stephan Houben
Hi Nathaniel, 2018-07-19 1:33 GMT+02:00 Nathaniel Smith : > Note that this everything you said here also exactly describes the > programming model for the existing 'multiprocessing' module: > "structured clone" is equivalent to how multiprocessing uses pickle to > transfer arbitrary objects, or y

Re: [Python-ideas] Multi-core reference count garbage collection

2018-07-19 Thread Stephan Houben
Hi Jonathan, 2018-07-19 8:33 GMT+02:00 Jonathan Fine : > I call any such scheme BUFFERED multi-core reference count garbage > collection. The worker processes know nothing about how garbage collection > is managed. Instead, they pass over to the GC process sufficient > information to allow it to

Re: [Python-ideas] The future of Python parallelism. The GIL. Subinterpreters. Actors.

2018-07-18 Thread Stephan Houben
Hi Eric, Antoine, all Antoine said that what I proposed earlier was very similar to what Eric is trying to do, but from the direction the discussion has taken so far that appears not to be the case. I will therefore try to clarify my proposal. Basically, what I am suggesting is a direct translat

Re: [Python-ideas] The future of Python parallelism. The GIL. Subinterpreters. Actors.

2018-07-15 Thread Stephan Houben
What about the following model: you have N Python interpreters, each with their own GIL. Each *Python* object belongs to precisely one interpreter. However, the interpreters share some common data storage: perhaps a shared Numpy array, or a shared Sqlite in-memory db. Or some key-value store where

Re: [Python-ideas] Add the imath module

2018-07-13 Thread Stephan Houben
Should we call sort then probable_sort, since the non-zero probability exists of it going wrong due to a stray cosmic ray? It's pointless to worry about failure modes which are order of magnitudes unlikelier than hardware failure. Stephan Op vr 13 jul. 2018 14:45 schreef Jeroen Demeyer : > On 2

Re: [Python-ideas] anyone need a frozenset or bytearray literal?

2018-07-12 Thread Stephan Houben
Hi all, While we are at it, could {"a":1, "b":2}.freeze() perhaps create a MappingProxyType? I've a gist at https://gist.github.com/stephanh42/d277170dd8a3a2f026c272a4fda15396 with a stand-alone freeze function which attempts to convert objects to a read-only version, and dict -> MappingProxyTy

Re: [Python-ideas] Secure string disposal (maybe other inmutable seq types too?)

2018-06-23 Thread Stephan Houben
Would it not be much simpler and more secure to just disable core dumps? /etc/security/limits.conf on Linux. If the attacker can cause and read a core dump, the game seems over anyway since sooner or later he will catch the core dump at a time the string was not yet deleted. Stephan Op za 23 j

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-13 Thread Stephan Houben
e the sin and cos of the y value. This is not how sine functions are calculated. They are calculated by reducing angle to some interval, then evaluating a polynomial which approximates the true sine within that interval. Stephan > On 6/13/18 6:07 AM, Stephan Houben wrote: > > 2018-06-13 12

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-13 Thread Stephan Houben
C-only). And then we'll probably end up with a bunch of if-checks against the common values. Stephan > > > Le mer. 13 juin 2018 à 12:07, Stephan Houben a > écrit : > >> 2018-06-13 12:00 GMT+02:00 Robert Vanden Eynde : >> >>> What was wrong with my

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-13 Thread Stephan Houben
of % on advice in this thread. 3. I also wanted to special case, 30, 45, and 60. > > If you want to support multiples of 30, you can do % 30 and // 30. > Sure, but I also wanted to special-case 45. Stephan > > Le mer. 13 juin 2018 à 09:51, Stephan Houben a > écrit : > &

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-13 Thread Stephan Houben
Op di 12 jun. 2018 12:41 schreef Nathaniel Smith : > On Tue, Jun 12, 2018, 00:03 Stephan Houben wrote: > >> Hi all, >> >> I wrote a possible implementation of sindg: >> >> https://gist.github.com/stephanh42/336d54a53b31104b97e46156c7deacdd >> >>

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-12 Thread Stephan Houben
Hi all, I wrote a possible implementation of sindg: https://gist.github.com/stephanh42/336d54a53b31104b97e46156c7deacdd This code first reduces the angle to the [0,90] interval. After doing so, it can be observed that the simple implementation math.sin(math.radians(angle)) produces exact resul

Re: [Python-ideas] Fwd: Trigonometry in degrees

2018-06-11 Thread Stephan Houben
2018-06-11 19:33 GMT+02:00 Michael Selik : > Whoops, it turns out Euler's formula does work! I expected imprecision, > but at least one test matched. > > x = 42 > cos(x) + 1j * sin(x) == e ** (1j * x) > I think you will find it holds for any x (except inf, -inf and nan). The boat is less leaky th

Re: [Python-ideas] Trigonometry in degrees

2018-06-10 Thread Stephan Houben
2018-06-09 8:18 GMT+02:00 Robert Vanden Eynde : > For the naming convention, scipy using sindg (therefore Nor sind nor > sindeg) will make the sind choice less obvious. However if Matlab and Julia > chooses sind that's a good path to go, Matlab is pretty popular, as other > pointed out, with Unive

Re: [Python-ideas] Let try-except check the exception instance

2018-05-31 Thread Stephan Houben
Current documentation says: "An object is compatible with an exception if it is the class or a base class of the exception object or a tuple containing an item compatible with the exception." https://docs.python.org/3/reference/compound_stmts.html#the-try-statement It is, in my opinion, not very

Re: [Python-ideas] Verbatim names (allowing keywords as names)

2018-05-18 Thread Stephan Houben
2018-05-18 15:37 GMT+02:00 Steven D'Aprano : > > Earlier you described this suggestion as "a silly joke". > > https://mail.python.org/pipermail/python-ideas/2018-May/050861.html The joke proposal was to write all keywords in Python using bold font variation, as a reaction to a similar joke prop

Re: [Python-ideas] Verbatim names (allowing keywords as names)

2018-05-18 Thread Stephan Houben
2018-05-18 13:37 GMT+02:00 Steven D'Aprano : > On Fri, May 18, 2018 at 11:17:13AM +0200, Stephan Houben wrote: > > > And the alternative is to replace all occurrences of > > spam with 𝐬𝐩𝐚𝐦 , which has the same effect and also is > > backward-compatible with 3.x f

Re: [Python-ideas] Verbatim names (allowing keywords as names)

2018-05-18 Thread Stephan Houben
2018-05-18 8:05 GMT+02:00 Greg Ewing : > Steven D'Aprano wrote: > >> It's Python 3.8, and I learn that in 4.0 "spam" is going to become a >> keyword. I simply take my code and change all the references spam to \spam, >> and I've future-proofed the code for 4.0 while still keeping compatibility >>

Re: [Python-ideas] Verbatim names (allowing keywords as names)

2018-05-17 Thread Stephan Houben
code bold. Because Python normalizes Unicode fonts but this is apparently AFTER keywords have been recognized. Stephan 2018-05-17 19:53 GMT+02:00 Stephan Houben : > Fortunately we have Unicode bold characters nowadays > > 𝐢𝐟 if 𝐢𝐧 in: > 𝐫𝐞𝐭𝐮𝐫𝐧 return > > Look m

Re: [Python-ideas] Verbatim names (allowing keywords as names)

2018-05-17 Thread Stephan Houben
Fortunately we have Unicode bold characters nowadays 𝐢𝐟 if 𝐢𝐧 in: 𝐫𝐞𝐭𝐮𝐫𝐧 return Look ma! No syntactic ambiguity! Stephan 2018-05-17 19:10 GMT+02:00 Chris Barker via Python-ideas < python-ideas@python.org>: > On Wed, May 16, 2018 at 2:09 PM, Carl Smith wrote: > >> If your position is that

Re: [Python-ideas] String and bytes bitwise operations

2018-05-17 Thread Stephan Houben
Seems you want numpy: >>> import numpy >>> numpy.frombuffer(b"Hello", dtype=numpy.uint8) ^ numpy.frombuffer(b"World", dtype=numpy.uint8) array([31, 10, 30, 0, 11], dtype=uint8) Stephan 2018-05-17 12:53 GMT+02:00 Ken Hilton : > Hi all, > > We all know the bitwise operators: & (and), | (or), ^ (

Re: [Python-ideas] Verbatim names (allowing keywords as names)

2018-05-16 Thread Stephan Houben
Hi all, One problem already alluded to with the \identifier syntax is that it only works if the old Python version is sufficiently recent to understand \. What about using parentheses to allow a keyword to be used as an identifier: (where)(x, y) This then in combination with allowing keywords in

Re: [Python-ideas] Crazy idea: allow keywords as names in certain positions

2018-05-13 Thread Stephan Houben
Note that Javascript does something similar, in that reserved keywords are allowed in member access. var x = {if : 42}; console.log(x.if); Stephan 2018-05-13 20:42 GMT+02:00 Eric Fahlgren : > On Sun, May 13, 2018 at 11:20 AM Guido van Rossum > wrote: > >> For example, we could allow keywords

Re: [Python-ideas] Move optional data out of pyc files

2018-04-10 Thread Stephan Houben
There are libraries out there like this: https://docopt.readthedocs.io/en/0.2.0/ which use docstrings for runtime info. Today we already have -OO which allows us to create docstring-less bytecode files in case we have, after careful consideration, established that it is safe to do so. I think t

Re: [Python-ideas] Sets, Dictionaries

2018-03-29 Thread Stephan Houben
Perhaps one day we will be able to use ∅ for the empty set. That would actually match conventional notation. Note that this is not valid syntax today (not a legal Unicode identifier). Stephan Op do 29 mrt. 2018 17:49 schreef Chris Angelico : > On Fri, Mar 30, 2018 at 2:42 AM, Julia Kim > wro

Re: [Python-ideas] Syntax idea for 2D lists\arrays

2018-03-15 Thread Stephan Houben
I'd just do this, which works today: == import numpy import io ar = numpy.loadtxt(io.StringIO(""" 1 5 9 155 53 44 44 34 """)) == Of course, this is only worth the trouble if you are somehow loading a very large matrix. (And then, are you sure you want to

Re: [Python-ideas] Descouraging the implicit string concatenation

2018-03-14 Thread Stephan Houben
Op 14 mrt. 2018 15:23 schreef "Facundo Batista" : I propose the discouragement of the idiom. What does that mean? Stephan Regards, -- .Facundo Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ Twitter: @facundobatista

Re: [Python-ideas] Descouraging the implicit string concatenation

2018-03-14 Thread Stephan Houben
Note that this has already been proposed and rejected before: https://www.python.org/dev/peps/pep-3126/ Stephan Op 14 mrt. 2018 15:01 schreef "Oleg Broytman" : > On Thu, Mar 15, 2018 at 12:15:52AM +1100, Steven D'Aprano < > st...@pearwood.info> wrote: > > On Wed, Mar 14, 2018 at 09:18:30AM -030

Re: [Python-ideas] PEP 572: Statement-Local Name Bindings

2018-03-02 Thread Stephan Houben
Hi all, I would like to observe that there is already a way to bind names in an expression: a = (lambda b: [b, b])(b=f()) Currently this is not so performant, but there is nothing stopping the compiler from special-casing such an IIFE (Immediate Invoked Function Expression), to use the Javascrip

Re: [Python-ideas] Temporary variables in comprehensions

2018-02-15 Thread Stephan Houben
Note that you can already do: [y + g(y) for x in range(10) for y in [f(x)]] i.e. for y in [expr] does exactly what the OP wants. No new syntax needed. If you hang out on python-list , you'll soon notice that many newbies struggle already with the list comprehension syntax. It's a mini-language

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

2018-02-06 Thread Stephan Houben
Hi all, Just want to point out that if tools can accept a config file in a cross-platform standard location (perhaps in addition to a platform-specific one), then that is incredibly useful. Just search on Github for "dotfiles", and see how many people store their configuration in a git repo, so t

Re: [Python-ideas] Format mini-language for lakh and crore

2018-02-01 Thread Stephan Houben
What about something like: f"{x:₹d}" ₹ = Indian Rupees symbol I realize it is not ASCII but ₹ would be, for the target audience, both easy to type (Ctrl-Alt-4 on Windows Indian English keyboard layout) and be mnemonic ("format number like you would format an amount in rupees"). Stephan 2018

Re: [Python-ideas] Format mini-language for lakh and crore

2018-01-28 Thread Stephan Houben
Hi David, Perhaps the "n" locale-dependent number formatting specifier should accept a , to have locale-appropriate formatting of thousand separators? f"{x:,n}" would Do The Right Thing(TM) depending on the locale. Today it is an error. Stephan 2018-01-28 7:25 GMT+01:00 David Mertz : > In So

Re: [Python-ideas] Why CPython is still behind in performance for some widely used patterns ?

2018-01-27 Thread Stephan Houben
Hi all, I would like to remark that, in my opinion, the question of CPython's performance cannot be decoupled from the extremely wide selection of packages which provide optimized code for almost any imaginable task. For example: Javascript may be faster than (C)Python on simple benchmarks, but a

Re: [Python-ideas] Support WHATWG versions of legacy encodings

2018-01-11 Thread Stephan Houben
Op 11 jan. 2018 10:56 schreef "Serhiy Storchaka" : 09.01.18 23:15, Rob Speer пише: > > > For the sake of discussion, let's call this encoding "web-1252". WHATWG > calls it "windows-1252", I'd suggest to name it then "whatwg-windows-152". and in general "whatwg-" + whatgwgs_name_of_encoding S

Re: [Python-ideas] Add an UML class diagram to the collections.abc module documentation

2017-12-30 Thread Stephan Houben
Hi Yahya, I like the full.png diagram, however, I see some issues with it. Most seriously, the methods it lists don't match the documentation. E.g. if you check MappingView: https://docs.python.org/3/library/collections.abc.html#collections.abc.MappingView you see it has only a __len__ mixin m

Re: [Python-ideas] Immutable dictionaries

2017-11-30 Thread Stephan Houben
2017-11-30 2:16 GMT+01:00 Rob Cliffe : > This is sort of a subset of an idea I once posted on Python-Ideas: > Dictionaries, sets and lists (etc. ?) could have a mutable flag, and once > it was set to False you could neither change it back nor change the > object. (OK there might be some backdoor

Re: [Python-ideas] [Python-Dev] What's the status of PEP 505: None-aware operators?

2017-11-29 Thread Stephan Houben
Op 29 nov. 2017 22:35 schreef "Greg Ewing" : It would read better with some kind of pronoun in there: A if it is not None else C Hypercard's Hypertalk had a special variable "it" that worked sort of like that. I considered that, but there are two issues. 1. Backward-incompatible change

Re: [Python-ideas] [Python-Dev] What's the status of PEP 505: None-aware operators?

2017-11-29 Thread Stephan Houben
What about a more general: A if B else C which would allow A if is not None else C but also e.g. A if >= 1 else 0 Stephan Op 29 nov. 2017 13:41 schreef "Nick Coghlan" : > On 29 November 2017 at 22:38, Stephan Houben wrote: > > What about more English-like synta

Re: [Python-ideas] [Python-Dev] What's the status of PEP 505: None-aware operators?

2017-11-29 Thread Stephan Houben
What about more English-like syntax: X or else Y E.g. cache.get(foo) or else expensive_call(foo) Stephan Op 29 nov. 2017 12:54 schreef "Serhiy Storchaka" : 29.11.17 11:45, Steven D'Aprano пише: On Wed, Nov 29, 2017 at 09:14:12AM +0200, Serhiy Storchaka wrote: > >> 29.11.17 08:08, Steven D'A

Re: [Python-ideas] Allow additional separator character in variables

2017-11-23 Thread Stephan Houben
US English is too broad. I propose everybody talk like in the "Dallas" TV series and wear mandatory cowboy hats. (Or was this mail just a dream?) Stephan 2017-11-23 15:29 GMT+01:00 Carl Smith : > Can't we just tell everyone to speak US English, and go back to ASCII? It > would be a less painf

Re: [Python-ideas] Adding a thin wrapper class around the functions in stdlib.heapq

2017-11-22 Thread Stephan Houben
I thought the purpose of heapq was to have a ready-made example for instructors on how an API can be improved by applying object-oriented techniques. ;-) I think adding a HeapQueue class would be a great idea. Obviously the existing functions would need to continue existing for backward compatibil

Re: [Python-ideas] Allow additional separator character in variables

2017-11-21 Thread Stephan Houben
Hi all, If anybody is still worried about this, here is a 29-line proof-of-concept code checker which warns if your source file contains identifiers which are different but look the same. https://gist.github.com/stephanh42/61eceadc2890cf1b53ada5e48ef98ad1 Stephan 2017-11-21 19:19 GMT+01:00 Mikh

Re: [Python-ideas] Allow additional separator character in variables

2017-11-21 Thread Stephan Houben
2017-11-21 12:55 GMT+01:00 Stephen J. Turnbull < turnbull.stephen...@u.tsukuba.ac.jp>: > Personally, I think that Python probably should ban non-ASCII > non-letter characters in identifiers and whitespace, and maybe add > them later in response to requests from native speakers of the > relevant la

Re: [Python-ideas] Allow additional separator character in variables

2017-11-19 Thread Stephan Houben
You think that's bad? https://github.com/reinderien/mimic/blob/master/README.md Abandon all hope ye who use Unicode. Op 19 nov. 2017 12:06 schreef "Antoine Pitrou" : > On Sun, 19 Nov 2017 09:38:17 +0200 > Serhiy Storchaka > wrote: > > 19.11.17 04:01, Mikhail V пише: > > > Python allows undersco

Re: [Python-ideas] Allow additional separator character in variables

2017-11-19 Thread Stephan Houben
There is an unfortunate ambiguity in using a character that means "not" as a word separator: nuke.do¬launch() "But... I called the method which explicitly did *not* launch the nuke!" Stephan Op 19 nov. 2017 11:05 schreef "Steve Barnes" : On 19/11/2017 05:01, Nick Timkovich wrote: > Python

Re: [Python-ideas] Allow additional separator character in variables

2017-11-18 Thread Stephan Houben
Note that Python already allows Unicode characters from class "connector punctuations (Pc)" in identifiers. No dashes in that, but if you are into that kind of thing, then this⁀is⁀a⁀valid⁀identifier . Stephan Op 19 nov. 2017 08:13 schreef "Bruce Leban" : > > On Sat, Nov 18, 2017 at 8:44 PM, Mik

Re: [Python-ideas] Ignorable whitespaces in the re.VERBOSE mode

2017-11-17 Thread Stephan Houben
I put the actual space characters here so you can see them in a non-proportional font (which I assume most Python programmer use). https://gist.github.com/stephanh42/7c1c122154fd3f26d864233a40d8 The control characters aren't rendered at all (Vim renders them as ^\ ^] ^^ ^_, respectively). Mos

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-14 Thread Stephan Houben
Hi Nick, 2017-11-14 11:07 GMT+01:00 Nick Coghlan : > On 14 November 2017 at 16:47, Michel Desmoulin > wrote: > >> Proposal A: >> --- >> >> Suffix Python executable on Windows like on Unix, so that people will >> type pythonX.X if they want a specify version. >> >> Pros: easy and discover

Re: [Python-ideas] venv *is* provided in the standard Python install on Debian/Ubuntu

2017-11-14 Thread Stephan Houben
nd which is at least consistent among python.org installers), and add weasel-wording to "consult documentation of third-party installers" 3. or leave the docs broken for at least some people some of the time. Stephan 2017-11-14 2:31 GMT+01:00 Brett Cannon : > > > On Mon, Nov

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-13 Thread Stephan Houben
Hi Chris, +1 to all three of these proposals! Stephan 2017-11-13 19:57 GMT+01:00 Chris Barker : > This has gotten to be a big thread, and it's a pretty intractable problem, > but I think there are a few fairly small things that could be done to at > least make it a bit easier: > > 1) Add python

Re: [Python-ideas] venv *is* provided in the standard Python install on Debian/Ubuntu

2017-11-13 Thread Stephan Houben
+01:00 Chris Angelico : > On Mon, Nov 13, 2017 at 10:29 AM, Nick Coghlan wrote: > > On 13 November 2017 at 07:11, Chris Angelico wrote: > >> On Mon, Nov 13, 2017 at 6:24 AM, Stephan Houben > wrote: > >>> Hi Antoine, > >>> > >>>

Re: [Python-ideas] venv *is* provided in the standard Python install on Debian/Ubuntu

2017-11-12 Thread Stephan Houben
2017-11-13 3:32 GMT+01:00 Nick Coghlan : > > So technically it's ensurepip that's broken by default, but that > translates to venv also being broken by default. > > I haven't worked out what the actual steps needed to fix it are > On Debian, ensurepip is in the python3.5-venv package. https://

Re: [Python-ideas] venv *is* provided in the standard Python install on Debian/Ubuntu

2017-11-12 Thread Stephan Houben
Hi Antoine, The venv module is included, however the pyvenv script is in a separate package python3.5-venv . By the way, I was totally confused by the following text form the doc. https://docs.python.org/3/library/venv.html Deprecated since version 3.6: pyvenv was the recommended tool

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-12 Thread Stephan Houben
2017-11-12 13:20 GMT+01:00 Paul Moore : > On 12 November 2017 at 06:19, Michel Desmoulin > wrote: > > > Well, not exactly. Do you do python -m venv, or py -x.x -m venv or > > pythonx -m venv ? Wait, it's not installed by default on debian. > > Seriously? Debian don't provide venv in the standard

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-07 Thread Stephan Houben
One (smaller) suggestion on the PATH situation on Windows: I noticed that Visual C++ Build Tools installs a number of "Command prompts" under its Start menu item, each of which starts a cmd.exe with appropriate PATH set to the appropriate compiler (32/64 bits or ARM cross-compiler), and assorted

Re: [Python-ideas] Proposal to change Python version release cycle

2017-11-06 Thread Stephan Houben
2017-11-06 12:53 GMT+01:00 Brice Parent : > > I think the only problem we can reach here, not only in our lifetimes, but > in the next years, is not Python3.10 vs Python31.0 (Python3.x will be long > dead when we reach this point!), but the ordering of versions, like > (python310 < python40). But

Re: [Python-ideas] Looking for input to help with the pip situation

2017-11-06 Thread Stephan Houben
Hi Michel, That's exactly why I proposed a `pip` function available from the Python prompt. I suppose you could still tell your students to copy/paste the following into their Python interpreter. def pip(args): import sys import subprocess subprocess.check_call([sys.executable, "-m",

Re: [Python-ideas] Proposal to change Python version release cycle

2017-11-05 Thread Stephan Houben
2017-11-05 21:02 GMT+01:00 Serhiy Storchaka : > But len(os.fsencode("python3⑽.dll")) != len(os.fsencode("python39.dll")). > > I think it is on Windows. os.fsencode should use UTF-16 there. ⑽ is in the BMP Presumably, non-Windows platforms wouldn't be interested in .dll files anyway... Stephan

Re: [Python-ideas] Proposal to change Python version release cycle

2017-11-05 Thread Stephan Houben
After python39.dll I'd expect python3A.dll . Or possibly python3⑽.dll >>> len("python3⑽.dll") == len("python39.dll") True No worries, then. Stephan 2017-11-05 20:28 GMT+01:00 Serhiy Storchaka : > 04.11.17 17:29, Wolfgang пише: > >> A good point but two digits minor version numbers have the po

Re: [Python-ideas] install pip packages from Python prompt

2017-10-30 Thread Stephan Houben
What about something like the following to simulate a "restart", portably. def restart(): import sys import os import subprocess if os.getenv("PYTHON_EXIT_ON_RESTART") == "1": sys.exit(42) else: env = os.environ.copy() env["PYTHON_EXIT_ON_RESTART"] = "1"

Re: [Python-ideas] install pip packages from Python prompt

2017-10-29 Thread Stephan Houben
; > > > *From:* Python-ideas [mailto:python-ideas-bounces+tritium-list=sdamon.com@ > python.org] *On Behalf Of *Stephan Houben > *Sent:* Sunday, October 29, 2017 3:19 PM > *To:* Python-Ideas > *Subject:* [Python-ideas] install pip packages from Python prompt > > > > Hi all

Re: [Python-ideas] install pip packages from Python prompt

2017-10-29 Thread Stephan Houben
t; sys.stderr.write(str(self)) >> >> >> >> def __repr__(self): >> >> return str(self) >> >> >> >> def __str__(self): >> >> return “Please run pip from your system command prompt” >> >> >> >&g

[Python-ideas] install pip packages from Python prompt

2017-10-29 Thread Stephan Houben
Hi all, Here is in somewhat more detail my earlier proposal for having in the interactive Python interpreter a `pip` function to install packages from Pypi. Motivation: it appears to me that there is a category of newbies for which "open a shell and do `pip whatever`" is a bit too much. It would

Re: [Python-ideas] Defining an easily installable "Recommended baseline package set"

2017-10-29 Thread Stephan Houben
Perhaps slightly off-topic, but I have sometimes wondered if pip could not be made somewhat friendlier for the absolute newbie and the classroom context. Some concrete proposals. 1. Add a function `pip` to the interactive interpreter (similar to how `help` is available). def pip(args):

Re: [Python-ideas] Defining an easily installable "Recommended baseline package set"

2017-10-28 Thread Stephan Houben
There are already curated lists of Python packages, such as: https://github.com/vinta/awesome-python Even better, if you don't agree, you can just clone it and create your own ;-) Stephan 2017-10-29 6:46 GMT+01:00 Alex Walters : > At this point, I would punt to distutils-sig about curated pack

Re: [Python-ideas] Dollar operator suggestion

2017-10-26 Thread Stephan Houben
Why not a functional syntax, i.e. compose(f, g, h) rather than f $ g $ h Advantage: you can do it today. Without need to convince Guido to add more line noise to the language. https://gist.github.com/stephanh42/6c9158c2470832a675fad7658048be9d Stephan 2017-10-26 13:06 GMT+02:00 Yan Pas : >

Re: [Python-ideas] Why not picoseconds?

2017-10-20 Thread Stephan Houben
Hi all, Please excuse me for getting a bit off-topic, but I would like to point out that except for bean-counters who need to be bug-compatible with accounting standards, decimal floating point is generally a bad idea. That is because the worst-case bound on the rounding error grows linear with t

Re: [Python-ideas] Memory limits [was Re: Membership of infinite iterators]

2017-10-19 Thread Stephan Houben
Hi Steve, 2017-10-19 1:59 GMT+02:00 Steven D'Aprano : > On Wed, Oct 18, 2017 at 02:51:37PM +0200, Stefan Krah wrote: > > > $ softlimit -m 10 python3 > [...] > > MemoryError > > > > > > People who are worried could make a python3 alias or use Ctrl-\. > > I just tried that on two different

Re: [Python-ideas] Membership of infinite iterators

2017-10-18 Thread Stephan Houben
Hi all, FWIW, I just tried the list(count()) experiment on my phone (Termux Python interpreter under Android). Python 3.6.2 (default, Sep 16 2017, 23:55:07) [GCC 4.2.1 Compatible Android Clang 5.0.300080 ] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import

Re: [Python-ideas] Why not picoseconds?

2017-10-16 Thread Stephan Houben
used to *define* the second. So we move to this new API, we should provide our own definition of the second, since those rough SI seconds are just too imprecise for that. Stephan 2017-10-16 9:03 GMT+02:00 Stefan Krah : > On Mon, Oct 16, 2017 at 08:40:33AM +0200, Stephan Houben wrote: > >

Re: [Python-ideas] Why not picoseconds?

2017-10-15 Thread Stephan Houben
2017-10-15 22:08 GMT+02:00 Eric V. Smith : >From Victor's original message, describing the current functions using 64-bit binary floating point numbers (aka double). They lose precision: "The problem is that Python returns time as a floatting point number > which is usually a 64-bit binary floatti

Re: [Python-ideas] Why not picoseconds?

2017-10-15 Thread Stephan Houben
Hi all, I propose multiples of the Planck time, 5.39 × 10 −44 s. Unlikely computers can be more accurate than that anytime soon. On a more serious note, I am not sure what problem was solved by moving from double to a fixed-precision format. I do know that it now introduced the issue of finding

Re: [Python-ideas] + operator on generators

2017-06-27 Thread Stephan Houben
people as being either a logical or binary &. On Tue, Jun 27, 2017 at 6:53 AM Stephan Houben wrote: > > Its the applications where it *is* important that > > we should be looking at. > > Um, yes, but given our relative positions in this debate, > the onus is not re

Re: [Python-ideas] + operator on generators

2017-06-27 Thread Stephan Houben
t;numerical processing", it is mostly *symbolic* calculations and involves a lot of complex algorithms and datastructures, including sequences.) Stephan 2017-06-27 13:48 GMT+02:00 Steven D'Aprano : > On Tue, Jun 27, 2017 at 01:32:05PM +0200, Stephan Houben wrote: >> Hi Steven, >>

Re: [Python-ideas] + operator on generators

2017-06-27 Thread Stephan Houben
ins, let alone to give it dedicated syntax. I also note that * for repetition is only supported for a few iterables (list, tuple), incidentally the same ones which support + for sequence chaining. Stephan 2017-06-27 12:38 GMT+02:00 Steven D'Aprano : > On Tue, Jun 27, 2017 at 11:01:32AM +0200

Re: [Python-ideas] + operator on generators

2017-06-27 Thread Stephan Houben
Hi all, Is "itertools.chain" actually that common? Sufficiently common to warrant its own syntax? In my experience, "enumerate" is far more common among the iterable operations. And that doesn't have special syntax either. A minimal proposal would be to promote "chain" to builtins. Stephan 20

Re: [Python-ideas] + operator on generators

2017-06-25 Thread Stephan Houben
I would like to add that for example numpy ndarrays are iterables, but they have an __add__ with completely different semantics, namely element-wise ( numerical) addition. So this proposal would conflict with existing libraries with iterable objects. Stephan Op 25 jun. 2017 2:51 p.m. schreef "Se

Re: [Python-ideas] Improving Catching Exceptions

2017-06-23 Thread Stephan Houben
sing this construct now... Stephan 2017-06-23 17:09 GMT+02:00 Andy Dirnberger : > Hi Stephan, > > On Fri, Jun 23, 2017 at 6:23 AM, Stephan Houben > wrote: >> >> Hi Andy, >> >> What you propose is essentially the "try .. catch .. in" construct as &g

Re: [Python-ideas] Improving Catching Exceptions

2017-06-23 Thread Stephan Houben
Hi Andy, What you propose is essentially the "try .. catch .. in" construct as described for Standard ML in: https://pdfs.semanticscholar.org/b24a/60f84b296482769bb6752feeb3d93ba6aee8.pdf Something similar for Clojure is at: https://github.com/rufoa/try-let So clearly this is something more peo

  1   2   >