Aw: Re: The task is to invent names for things

2021-10-27 Thread Karsten Hilbert
> > I don't know. A mediocre name conveys at least some information, and > > that seems to be better than none. On the other hand it might be just > > enough to lead the reader astray which wouldn't happen with a > > non-sensical name. I was thinking that a nonsensical name might lead readers to g

RE: walrus with a twist :+= or ...

2021-10-27 Thread Avi Gross via Python-list
Correct, I left out a bit, not wisely. I am trying to remember the last time (outside of classes) I have ever had to use bitwise operators nontrivially and it may have been around 1980 when I had to implement an encryption algorithm. Of course, when I was working in UNIX, I often had to combine bi

Re: Why so fast a web framework?

2021-10-27 Thread Abdur-Rahmaan Janhangeer
@Chris @Peter See that famous benchmark https://www.techempower.com/benchmarks/#section=data-r20 Like routinely PHP frameworks appear higher up than py -- https://mail.python.org/mailman/listinfo/python-list

RE: walrus with a twist :+= or ...

2021-10-27 Thread Avi Gross via Python-list
My apologies, again. I got Chris going and although quite humorous, we may want to allow a slew of emoticons! But a serious question is now that we sort of have UNICODE, and even many editors and other programs support it, perhaps it might make sense for some operations in computer languages to ma

Re: The task is to invent names for things

2021-10-27 Thread Chris Angelico
On Thu, Oct 28, 2021 at 11:55 AM Eli the Bearded <*@eli.users.panix.com> wrote: > The choice of a non-sensical is perfectly fine _when_ it's a major > component. Kafka, Python, Java, Rust. Those are all non-sensically named, > in that the name doesn't fit what it is, by pun, initials, or reference.

Re: walrus with a twist :+= or ...

2021-10-27 Thread MRAB
On 2021-10-28 02:06, Avi Gross via Python-list wrote: I just realized I left out **= so my apologies. Are there other such abbreviations and does anyone use them? You forgot about the bitwise operators: |= &= ^= -Original Message- From: Python-list On Behalf Of Avi Gross via Python

Re: walrus with a twist :+= or ...

2021-10-27 Thread Chris Angelico
On Thu, Oct 28, 2021 at 11:58 AM Avi Gross via Python-list wrote: > On a serious note, if it was ever considered a good idea, what would be an > acceptable sequence of symbols that might not break or confuse existing > programs and what would we call it? I mean what animal, of course. > > > > What

RE: walrus with a twist :+= or ...

2021-10-27 Thread Avi Gross via Python-list
I just realized I left out **= so my apologies. Are there other such abbreviations and does anyone use them? -Original Message- From: Python-list On Behalf Of Avi Gross via Python-list Sent: Wednesday, October 27, 2021 8:57 PM To: python-list@python.org Subject: walrus with a twist :+= or

walrus with a twist :+= or ...

2021-10-27 Thread Avi Gross via Python-list
I realized that the person seeking completeness in Python may next ask why the Walrus operator, :=, is not properly extended to include a whole assortment of allowed assignment operators I mean in normal python programs you are allowed to abbreviate x = x + 5 with x += 5 Similar

Re: The task is to invent names for things

2021-10-27 Thread Eli the Bearded
In comp.lang.python, Peter J. Holzer wrote: ^^ > On 2021-10-27 12:41:56 +0200, Karsten Hilbert wrote: >> In that situation, is it preferable to choose a nonsensical >> name over a mediocre one ? > I don't know. A mediocre name conveys at least some information, and > that seems t

Re: New assignmens ...

2021-10-27 Thread Chris Angelico
On Thu, Oct 28, 2021 at 11:08 AM Avi Gross via Python-list wrote: > > Dave, > > You make me wonder about unintended side effects. Are we allowing the ++ and > --- operations into Python through a side door? > class IncrementableInteger(int): def __pos__(self): return HalfIncremented(self)

RE: New assignmens ...

2021-10-27 Thread Avi Gross via Python-list
Dave, You make me wonder about unintended side effects. Are we allowing the ++ and --- operations into Python through a side door? any context that allows you to insert the walrus operator like: index := index + 1 index := index - 1 Is now similar to notations in C/C++ and other

RE: Create a contact book

2021-10-27 Thread Avi Gross via Python-list
I used to be on the Tutor list for python and found it was not for me. Yes, we should refer people there especially those who seem to have HW and would like some gentle coaching but not outright answers. What frustrated me is that rarely would we be told by people what they had learned and were

Re: The task is to invent names for things

2021-10-27 Thread Peter J. Holzer
On 2021-10-27 12:41:56 +0200, Karsten Hilbert wrote: > Am Tue, Oct 26, 2021 at 11:36:33PM + schrieb Stefan Ram: > > xyzzy = lambda x: 2 * x > > . Sometimes, this can even lead to "naming paralysis", where > > one thinks excessively long about a good name. To avoid this > > naming paralysi

Re: The task is to invent names for things

2021-10-27 Thread dn via Python-list
On 27/10/2021 23.41, Karsten Hilbert wrote: > Am Tue, Oct 26, 2021 at 11:36:33PM + schrieb Stefan Ram: > >> xyzzy = lambda x: 2 * x >> >> . Sometimes, this can even lead to "naming paralysis", where >> one thinks excessively long about a good name. To avoid this >> naming paralysis, one

Re: The task is to invent names for things

2021-10-27 Thread Chris Angelico
On Thu, Oct 28, 2021 at 7:54 AM Karsten Hilbert wrote: > > Am Wed, Oct 27, 2021 at 10:00:16PM +1100 schrieb Chris Angelico: > > > > Am Wed, Oct 27, 2021 at 10:20:19AM +1100 schrieb Chris Angelico: > > > > > > > Many operations in computing are fully reversible. After you do > > > > something, you

Re: The task is to invent names for things

2021-10-27 Thread Karsten Hilbert
Am Wed, Oct 27, 2021 at 12:41:56PM +0200 schrieb Karsten Hilbert: > Am Tue, Oct 26, 2021 at 11:36:33PM + schrieb Stefan Ram: > > > xyzzy = lambda x: 2 * x > > > > . Sometimes, this can even lead to "naming paralysis", where > > one thinks excessively long about a good name. To avoid this >

Re: The task is to invent names for things

2021-10-27 Thread Karsten Hilbert
Am Wed, Oct 27, 2021 at 10:00:16PM +1100 schrieb Chris Angelico: > > Am Wed, Oct 27, 2021 at 10:20:19AM +1100 schrieb Chris Angelico: > > > > > Many operations in computing are fully reversible. After you do > > > something, you can undo it. After you assign, you can unassign. And > > > after you

Re: Why so fast a web framework?

2021-10-27 Thread Peter J. Holzer
On 2021-10-27 23:49:59 +0400, Abdur-Rahmaan Janhangeer wrote: > See this: > https://github.com/walkor/webman > > Why similar frameworks do not exist in Python. Is it because > of lack of lib contributors or due to an inherent difference in Py > and PHP? Thanks! The comparison table contains only

Re: Why so fast a web framework?

2021-10-27 Thread Chris Angelico
On Thu, Oct 28, 2021 at 6:52 AM Abdur-Rahmaan Janhangeer wrote: > > See this: > https://github.com/walkor/webman > > Why similar frameworks do not exist in Python. Is it because > of lack of lib contributors or due to an inherent difference in Py > and PHP? Thanks! > It depends entirely on what t

Re: Does loading PDB slow down execution?

2021-10-27 Thread Peter J. Holzer
On 2021-10-27 15:47:08 -0400, Benjamin Schollnick wrote: > > On Oct 27, 2021, at 1:01 PM, Unixnut wrote: [...] > > Excellent, many thanks for confirming. I can leave the execution running > > then. > > But it’s pointless to import pdb, if you aren’t going to use it. Please read the first mail i

Why so fast a web framework?

2021-10-27 Thread Abdur-Rahmaan Janhangeer
See this: https://github.com/walkor/webman Why similar frameworks do not exist in Python. Is it because of lack of lib contributors or due to an inherent difference in Py and PHP? Thanks! Kind Regards, Abdur-Rahmaan Janhangeer about | blog

Re: Does loading PDB slow down execution?

2021-10-27 Thread Benjamin Schollnick
> On Oct 27, 2021, at 1:01 PM, Unixnut wrote: > > On 06/10/2021 18:30, Dieter Maurer wrote: >> Unixnut wrote at 2021-10-3 22:03 +0100: >>> If I run a python3 program with "import pdb" in the code, would it >>> execute slower than without loading the debugger? >> Importing `pdb` does not slow do

Get a Joke in Python

2021-10-27 Thread Python 4 Fun
Get a Joke in Python. Pyjokes - is a python library / module for one line joke program based on programmers. You can get funny one-liner random jokes at every run also available in following " languages " & " categories ". Supported Languages By Pyjokes English — ‘en’ Spanish — ‘es’ Italian — ‘i

Re: New assignmens ...

2021-10-27 Thread Abdur-Rahmaan Janhangeer
I no longer track the threads on the subject ... Many simultaneous ones ongoing! Kind Regards, Abdur-Rahmaan Janhangeer about | blog github Mauritius -- https://mail.python.org/mailman/listin

Re: New assignmens ...

2021-10-27 Thread Chris Angelico
On Thu, Oct 28, 2021 at 4:34 AM Christman, Roger Graydon wrote: > Do you put special code in next_couple() to recognize that the provided > arguments > are actually the first couple so it can return those unmodified, but then > require its > own mental note not to give you an infinite loop forev

Re: Does loading PDB slow down execution?

2021-10-27 Thread Unixnut
On 06/10/2021 18:30, Dieter Maurer wrote: Unixnut wrote at 2021-10-3 22:03 +0100: If I run a python3 program with "import pdb" in the code, would it execute slower than without loading the debugger? Importing `pdb` does not slow down the application significantly (it just adds the import time

Re: New assignmens ...

2021-10-27 Thread Chris Angelico
On Thu, Oct 28, 2021 at 4:03 AM Antoon Pardon wrote: > > So suppose I have an arbitrary number of simple statements. The > latter possible using results from previous assignment and at the > end a condition to control the one and a half loop. How do you write > the python code so that the one and

RE: New assignmens ...

2021-10-27 Thread Avi Gross via Python-list
I think anyone who suggests we should separate costs from benefits belongs securely within the academic world and should remain there. Practical things need to be built considering costs. Theoretical things, sure, cost is not an issue. Python is not only a real-world set of applications but an ev

Re: New assignmens ...

2021-10-27 Thread Christman, Roger Graydon
On 27/10/2021 8:28, Anton Pardon wrote: >>> Suppose I would like to write a loop as follows: >>. >while ((a, b) := next_couple(a, b))[1]: >> >do needed calculations >> >> >>> What I can do is write it as follows: >>> while [tmp := next_couple(a,b), a := tmp[0], b := tmp[1]][

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 27/10/2021 om 18:16 schreef Christman, Roger Graydon: On 27/10/2021 at 12:45 Antoon Pardon wrote: However with the introduction of the walrus operator there is a way to simulate a significant number of one and a half loops. Consider the following: >do > a = expr1 >

Re: New assignmens ...

2021-10-27 Thread Christman, Roger Graydon
On 27/10/2021 at 12:45 Antoon Pardon wrote: > However with the introduction of the walrus operator there is a > way to simulate a significant number of one and a half loops. > Consider the following: >do > a = expr1 > b = expr2 > while 2 * a > b: > more calculations

Re: The task is to invent names for things

2021-10-27 Thread Peter J. Holzer
On 2021-10-27 22:00:16 +1100, Chris Angelico wrote: > On Wed, Oct 27, 2021 at 9:41 PM Karsten Hilbert > wrote: > > Am Wed, Oct 27, 2021 at 10:20:19AM +1100 schrieb Chris Angelico: > > > Many operations in computing are fully reversible. After you do > > > something, you can undo it. After you ass

Re: The task is to invent names for things

2021-10-27 Thread Chris Angelico
On Wed, Oct 27, 2021 at 9:41 PM Karsten Hilbert wrote: > > Am Wed, Oct 27, 2021 at 10:20:19AM +1100 schrieb Chris Angelico: > > > Many operations in computing are fully reversible. After you do > > something, you can undo it. After you assign, you can unassign. And > > after you ite, you can unite

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 27/10/2021 om 11:59 schreef Chris Angelico: You can argue the word "need" all you like, but the fact remains that YOU want a change, so YOU have to convince people of the benefits. That is true. But there is nothing wrong in asking what might convince people. But I'll give you my thought

Re: The task is to invent names for things

2021-10-27 Thread Karsten Hilbert
Am Tue, Oct 26, 2021 at 11:36:33PM + schrieb Stefan Ram: > xyzzy = lambda x: 2 * x > > . Sometimes, this can even lead to "naming paralysis", where > one thinks excessively long about a good name. To avoid this > naming paralysis, one can start out with a mediocre name. In > the course

Re: The task is to invent names for things

2021-10-27 Thread Karsten Hilbert
Am Wed, Oct 27, 2021 at 10:20:19AM +1100 schrieb Chris Angelico: > Many operations in computing are fully reversible. After you do > something, you can undo it. After you assign, you can unassign. And > after you ite, you can unite! I wonder whether Japanese programmers would agree. Karsten -- G

Re: How to store the result of df.count() as a new dataframe in Pandas?

2021-10-27 Thread Tim Williams
On Tue, Oct 26, 2021 at 6:36 PM Shaozhong SHI wrote: > Hello, > > The result of df.count() appears to be a series object. How to store the > result of df.count() as a new dataframe in Pandas? > > That is data anyhow. > > Regards, > > David > -- > https://mail.python.org/mailman/listinfo/python-l

Re: New assignmens ...

2021-10-27 Thread Chris Angelico
On Wed, Oct 27, 2021 at 8:20 PM Antoon Pardon wrote: > > > > Op 27/10/2021 om 10:49 schreef Chris Angelico: > > On Wed, Oct 27, 2021 at 7:46 PM Antoon Pardon wrote: > >>> So if you want this added, show a use-case that makes it look way > >>> better than the alternatives (including a generator, a

Re: New assignmens ...

2021-10-27 Thread Peter J. Holzer
On 2021-10-24 11:23:48 +0200, O365 Dict wrote: > do: > a, b = calculate_next_couple(a, b) > while b: > more calculations I actually like that syntax. -- _ | Peter J. Holzer| Story must make more sense than reality. |_|_) || | | | h...@hjp.at

Re: New assignmens ...

2021-10-27 Thread Peter J. Holzer
On 2021-10-27 19:05:52 +1100, Chris Angelico wrote: > On Wed, Oct 27, 2021 at 6:00 PM Antoon Pardon wrote: > > while (a, b) := next_couple(a,b)[-1]: > > ... [...] > I'm not sure that it's much of a use-case; isn't it an infinite loop as > written? > > And that's the problem. With multiple-

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 27/10/2021 om 10:49 schreef Chris Angelico: On Wed, Oct 27, 2021 at 7:46 PM Antoon Pardon wrote: So if you want this added, show a use-case that makes it look way better than the alternatives (including a generator, a mid-loop break, etc). Way better according to which criteria? IMO to r

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 27/10/2021 om 10:38 schreef dn via Python-list: On 24/10/2021 22.23, O365 Dict wrote: Well I have the following use case: while (temp_result := calculate_next_couple(a, b))[1]: a, b = temp_result more calculations Which IMO would be clearer if I could just write:

Re: New assignmens ...

2021-10-27 Thread Chris Angelico
On Wed, Oct 27, 2021 at 7:39 PM dn via Python-list wrote: > Accordingly: is this a job for the walrus operator at all? Let's "talk > of many [other] things"*. +1 > Could we use a data structure to continue to keep things straight-forward? > > class my_class(): > def __init__( self, a, b )->N

Re: New assignmens ...

2021-10-27 Thread Chris Angelico
On Wed, Oct 27, 2021 at 7:46 PM Antoon Pardon wrote: > > So if you want this added, show a use-case that makes it look way > > better than the alternatives (including a generator, a mid-loop break, > > etc). > > Way better according to which criteria? IMO to realy make something like > this you wo

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 27/10/2021 om 10:05 schreef Chris Angelico: On Wed, Oct 27, 2021 at 6:00 PM Antoon Pardon wrote: Op 26/10/2021 om 00:24 schreef Chris Angelico: TBH, I don't think there's a lot of value in multiple-assignment, since it has a number of annoying conflicts of syntax and few viable use-cas

Re: New assignmens ...

2021-10-27 Thread dn via Python-list
On 24/10/2021 22.23, O365 Dict wrote: > Well I have the following use case: > > while (temp_result := calculate_next_couple(a, b))[1]: > a, b = temp_result > more calculations > > Which IMO would be clearer if I could just write: > > while ((a, b) := calculate_next_couple

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 27/10/2021 om 10:05 schreef Chris Angelico: On Wed, Oct 27, 2021 at 6:00 PM Antoon Pardon wrote: Op 26/10/2021 om 00:24 schreef Chris Angelico: TBH, I don't think there's a lot of value in multiple-assignment, since it has a number of annoying conflicts of syntax and few viable use-cas

Re: New assignmens ...

2021-10-27 Thread Chris Angelico
On Wed, Oct 27, 2021 at 6:00 PM Antoon Pardon wrote: > > > > Op 26/10/2021 om 00:24 schreef Chris Angelico: > > TBH, I don't think there's a lot of value in multiple-assignment, > > since it has a number of annoying conflicts of syntax and few viable > > use-cases. But if you have great examples o

Re: New assignmens ...

2021-10-27 Thread Antoon Pardon
Op 26/10/2021 om 00:24 schreef Chris Angelico: TBH, I don't think there's a lot of value in multiple-assignment, since it has a number of annoying conflicts of syntax and few viable use-cases. But if you have great examples of "x.y :=" or "x[y] :=", then by all means, post on python-ideas to p