Re: [Python-ideas] A more readable way to nest functions

2017-01-27 Thread João Santos
Hi, This would break apart as soon as one of left functions takes more than one parameter. Best regards, João Santos On Fri, 27 Jan 2017, 22:08 Brent Brinkley, <brentbrink...@gmail.com> wrote: > HI Everyone, > > I’m relatively new to the world of python but in my short time her

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-11 Thread João Santos
+1 to this reasoning. One of the main reason python is popular is because code is easy to read, while ":=" would clearly not be as readable as "given". For me the difference between "given" and ":=" is the same as between python and C for loops. On Fri, 11 May 2018 at 09:06 Greg Ewing

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-11 Thread João Santos
Optimizing syntax for space makes sense for "mathematical" notation since it's commonly written by hand, but putting space above readability in a programming language design feels like a skewmorphism. On Fri, 11 May 2018 at 11:41 Jacco van Dorp wrote: > I dont really like

Re: [Python-ideas] Inline assignments using "given" clauses

2018-05-11 Thread João Santos
How do you read something like " while (cmd := get_command()).token != CMD_QUIT:" in plain english? On Fri, 11 May 2018 at 12:15 Jacco van Dorp <j.van.d...@deonet.nl> wrote: > 2018-05-11 11:56 GMT+02:00 João Santos <j...@jsantos.eu>: > > Optimizing syntax for spac

Re: [Python-ideas] Make asyncio.get_event_loop a builtin

2018-05-25 Thread João Santos
Hi, You can use uvloop <https://github.com/MagicStack/uvloop>, for example, without using asyncio: import uvloop loop = uvloop.new_event_loop() loop.run_forever() Best regards, João Santos On Fri, 25 May 2018 at 02:42, Ken Hilton <kenlhil...@gmail.com> wrote: > On Tue May 22

Re: [Python-ideas] string method count()

2018-04-25 Thread João Santos
rds, João Santos On Wed, 25 Apr 2018 at 20:22 Julia Kim <julia.hiyeon@gmail.com> wrote: > Hi, > > There’s an error with the string method count(). > > x = ‘AAA’ > y = ‘AA’ > print(x.count(y)) > > The output is 1, instead of 2. > > > I write programs

Re: [Python-ideas] Revisiting Immutable Mappings

2018-10-10 Thread João Santos
One important difference between MappingProxyType and a "proper" frozendict, as analog to frozenset, is that MappingProxyType doesn't have any method to return mutated versions of itself. On Thu, 11 Oct 2018 at 01:24, Steven D'Aprano wrote: > Hi Philiip, and welcome, > > On Wed, Oct 10, 2018 at

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

2018-09-13 Thread João Santos
One important difference between master/slave and beautiful/ugly is that the first pair are concrete concepts that typically applies to people, and the second are abstract concepts that always applied also to objects and abstract concepts. On Thu, 13 Sep 2018 at 13:16, Antoine Pitrou wrote:

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

2018-09-13 Thread João Santos
/beautiful to body shaming is a considerably bigger stretch. On Thu, 13 Sep 2018 at 14:22, Chris Angelico wrote: > On Thu, Sep 13, 2018 at 10:16 PM, João Santos wrote: > > One important difference between master/slave and beautiful/ugly is that > the > > first pair are

[Python-ideas] Re: python interpreter docker builder

2020-04-07 Thread João Santos
On Tuesday, 7 April 2020 10:52:36 CEST M.-A. Lemburg wrote: > Hi Antonio, > > you may want to have a look at the Alpine images for Python > and this optimized variant: > > https://github.com/jfloff/alpine-python > > They also come with dev tools installed. Still, they are overall > rather

[Python-ideas] Re: Pickle security improvements

2020-07-20 Thread João Santos
Pydantic (https://pydantic-docs.helpmanual.io/) can already do that. On Monday, 13 July 2020 21:03:14 CEST Edwin Zimmerman wrote: > I would have interest in it. > > > > --Edwin > > > > > > I'm no security expert, but we've got a big pile of serialization code that > is kind of like

[Python-ideas] Re: Extension methods in Python

2021-06-23 Thread João Santos
On Wed, Jun 23 2021 at 20:48:39 +1000, Steven D'Aprano wrote: I've just thought of a great use-case for extension methods. Hands up who has to write code that runs under multiple versions of Python? *raises my hand* I'm sure I'm not the only one. You probably have written compatibility

[Python-ideas] Re: Void type

2022-07-25 Thread João Santos
You can easily achieve this with something like Void = object() def func(param=Void):   if param is Void:     param = "default" or in the wrapper: Void = object() def wrapper(param=Void, **kwargs):   if param is not Void:     kwargs["param"] = param   return func(**kwargs) With some