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

2021-10-28 Thread Karsten Hilbert
> Karsten Hilbert  writes:
> >ite is the -te form (in some uses like a gerundium) of aru
> >(to go, to walk)
> 
>   This form, "行って", is written with two "t", as "itte",
>   in many transcriptions to convey the gemination (っ) of
>   the "t". There is, however, "ite", "居て", the -te form of
>   "居る" ("iru" - "to be"), which usually is transcribed "ite".

I stand corrected, thanks. Not the first time that ite/itte
slipped :-/

At any rate, it, eh, is rather malleable to word play.

Karsten

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New assignmens ...

2021-10-28 Thread Antoon Pardon




Op 27/10/2021 om 20:20 schreef Avi Gross:

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.


Seperating costs from benefits doesn't mean costs are not an issue. It means
you don't deny de benefits because there are costs. Sure in the end the costs
may outweight the benefits but that is still not the same as there being no
benefits at all.

If you want to weight the costs against the benefits you need to acknowledge
both and not start by denying the benefits because you presume they will
not outweight the costs.

--
Antoon.

--
https://mail.python.org/mailman/listinfo/python-list


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

2021-10-28 Thread Abdur-Rahmaan Janhangeer
The proposal is very interesting, my only concern is readability
unless a team has a tool check and flag it out as a process.

Else i fear one day i'll be seeing =+_+= in Python code.

But jokes aside @Avi why would someone want to immediately add a 2
after walrus defining it? in :+=2

Kind Regards,

Abdur-Rahmaan Janhangeer
about  | blog

github 
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New assignmens ...

2021-10-28 Thread Antoon Pardon




Op 27/10/2021 om 17:05 schreef Christman, Roger Graydon:

I'm going to provide two loop-and-a-half segments to illustrate my 
interpretation
of this PEP and the purpose of the walrus operator:

[ first example ]

Now contrast with this example:

Without the walrus:

replay = True
while replay:
 play_game()
 replay = input("Play again? ") in ['y','Y','yes','Yes']

(I think it silly to ask about playing again at first).

With the walrus:

replay = None
while replay==None or (replay := input("Play again? ") in ['y','Y','yes','Yes']:
  play_game()

To use the walrus operator here, I have to fabricate a value that would
allow me to bypass the input operation, that cannot be otherwise produced.
I do not find this second version any clearer or more intuitive than the first
(and the PEP did emphasize the value of clarity).


But the above is not a one and a half loop. The above is essentially a do
loop (repeat loop in pascal), where you have the test at the end of the
loop body. But because python doesn't have that loop you have to use a
boolean to control the loop that is initialized to True and then later
assign that boolean the result of the test which you use to control this
loop.

Should I think it worth the trouble to rewrite your example, quod non,
it would be like below, with that unneeded list.

while [
play_game(),
input("Play again? ") in ['y', 'Y', 'yes', 'Yes']][-1]:
pass

--
Antoon Pardon.

--
https://mail.python.org/mailman/listinfo/python-list


FlaskCon 2021: The Last Call

2021-10-28 Thread Abdur-Rahmaan Janhangeer
Greetings everybody,

FlaskCon's CFP closes soon. If you plan to push in some talks,
please do so. Don't worry about reviewing and push it in, like
it's very simple to get started with and this year might be the last
online one.

This year it's pre-recorded with optional live QnA. So internet connection
should not be an issue.

Submit talks:
https://flaskcon.com/y/2021/

Kind Regards,

Abdur-Rahmaan Janhangeer
about  | blog

github 
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2021-10-28 Thread Peter J. Holzer
On 2021-10-27 22:15:09 -0400, Avi Gross via Python-list wrote:
> 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 make use of them.

I have thought so since the 1990's.

But while the large variety of unicode symbols is great for displaying
programs, it is awful for entering them. Keyboards have a limited number
of keys (and those are fairly standardized, if a different standard in
each country), so you either have to combine several keys or need to
pick characters by a different method (e.g. the mouse). Both are
cumbersome, shift the attention of the programmer from the algorithm to
the mechanics of entry, and are different from editor to editor.

I sometimes use Greek letters in variable names. But I do that only for
personal projects, not at work. I can't expect my co-workers to find out
how enter Greek letters in PyCharm or Visual Studio Code or Notepad++ or
whatever they are using and I don't want to do that research myself (I
know how to use digraphs im vim, thank you). And we are a small team.
Think of the diversity in a large multi-national company ...

It might work if the language is tightly integrated with an IDE. Then
the designers of the IDE and the designers of the language can work
together to make it easy to edit programs. And everyone who uses the
language has to use the IDE anyway (because of the tight integration),
so "but how do I type that in Notepad++?" is not a concern.

But tying together a language to an IDE that tightly will turn away all
programmers who are already used to a different IDE (or just plain
editor) and want to continue to use that.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Python and Flask Book

2021-10-28 Thread Bruno Oliveira
Hello all,

I would like to spread the word about a new Python book I have released, on
how to develop a web application using Flask and deploying it on Heroku.
It's geared more towards beginners or towards anyone who is willing to
learn Python and Flask!

I would be very glad if you know of people, friends, or colleagues who are
interested in learning Python and could spread words about my book:

https://brunooliv.gumroad.com/l/cookpythonbook


Best regards,
Bruno
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New assignmens ...

2021-10-28 Thread Jon Ribbens via Python-list
On 2021-10-28, Paul Rubin  wrote:
> Chris Angelico  writes:
>> But it all depends on the exact process being done, which is why I've
>> been asking for real examples.
>
> My most frequent use case for walrus is so common that I have sometimes
> implemented a special class for it:
>
>if g := re.search(pat1, text):
>   hack(g.group(1))
>elif g := re.search(pat2, text):
>   smack(g.group(2), "foo")
>...
>
> It's way messier if you have to separate the assignment and test the old
> way.  That said, I'm still on Python 3.7 so I haven't yet gotten to use
> walrus or the new match statement (or is it expression).
>
> I do feel surprised that you can't use an arbitrary lvalue (to use C
> terminology) on the lhs of a walrus.  That seems downright weird to me.
> But, I haven't studied the PEP so I don't know if there was a particular
> rationale.

Well, that's what I was saying: there's no rationale - the limitation
is not even mentioned, let alone explained.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why so fast a web framework?

2021-10-28 Thread Calvin Spealman
Who cares?

On Wed, Oct 27, 2021 at 10:47 PM Abdur-Rahmaan Janhangeer <
arj.pyt...@gmail.com> wrote:

> @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
>
>

-- 

CALVIN SPEALMAN

SENIOR QUALITY ENGINEER

calvin.speal...@redhat.com  M: +1.336.210.5107
[image: https://red.ht/sig] 
TRIED. TESTED. TRUSTED. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why so fast a web framework?

2021-10-28 Thread Abdur-Rahmaan Janhangeer
Me

Like why exactly is that the case, i would not be surprised for rust, C,
CPP etc
But as to where the difference comes for two comparatively similar langs.

Kind Regards,

Abdur-Rahmaan Janhangeer
about  | blog

github 
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2021-10-28 Thread Avi Gross via Python-list
Names can be taken too far as the same variable may have different
connotations in one place than another.

Say I am counting how many of something and incrementing variable HowMany as
I go along and initialized to zero. Then I want to test if I have any and
instead of:

if (HowMany > 0)

I decide to be cute and depend on the truthiness of HowMany like:

if (HowMany)

The latter is a tad hard to parse for some people and if it had been named
WeHaveAny then the code would sort of make sense:

if (WeHaveAny)

Somewhere else in the code some other names might make sense and make the
program easier to read.

So, the obvious solution is to ask the language, like Python, to allow
variables that are synonyms. In languages with pointers, this can often be
done fairly easily. In some languages with some optimizations, it can be
dangerous as some copies of this kind can later be changed to an actual copy
when the underlying data changes.

So, since at the moment you might not be able to do this:

HowMany = 0
alias HowMany WeHaveAny

Then if this feature matters to you, you could cautiously write code that
declares a second variable and copies either the current value of the first
or a Boolean true/false.

I am sure many of us (meaning me) have often named a variable and later
reconsidered once we saw the role it plays in various parts of the program
and had to go back and change everything. As other have noted, it is not a
trivial task and really good names often end up being really long names
which are also a pain especially when other really long names start with the
same characters. Compilers don't care but humans reading the code may give
up!

Worse, many times the code consists of longer combinations and trying to
keep within reasonable (printable) line lengths gets hard.

MyHumoungousDictionaryContainingElectionResults[SomeCountyInSomeStateOfTheUS
] =
MyHumoungousDictionaryContainingElectionResults[SomeCountyInSomeStateOfTheUS
] + TheOfficialCertifiedVoteCountOfThisRegion




-Original Message-
From: Python-list  On
Behalf Of Karsten Hilbert
Sent: Thursday, October 28, 2021 2:50 AM
Cc: python-list@python.org
Subject: Aw: Re: The task is to invent names for things

> > 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 go beyond the
name when trying to understand code, and would prompt me to improve upon the
name upon reading my own code (and having acquired, likely, a better
understanding of the concept that's to be named).

Karsten

--
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


RE: New assignmens ...

2021-10-28 Thread Avi Gross via Python-list
Antoon,

 

You keep beating a dead horse. NOBODY denies there are benefits to suggestions 
like the one we are describing. It is a logical fallacy to keep arguing this 
way.

 

And nobody (meaning me) suggests costs are a dominant factor in decisions no 
matter the benefits. The realistic suggestion is to not only weight costs and 
benefits for one proposal but for all reasonable proposals and then choose.

 

I have no idea what the actual cost of changing the parser is. It may be 
trivial or very nontrivial. I do not know if the actual chosen change, from a 
range of possible implementations, will leave the speed of typical programs 
untouched or will add lots of overhead for all programs including the ones not 
using this feature. Nor do I know how many existing features might clash with 
the choice of implementation and need to be changed to resolve them or face 
lots of bug reports later.

 

So what I and others have said here is not based completely on known and 
measured facts. But before approving a proposal, some analysis and estimates 
must be made including a decision to just cancel any work if it over-runs 
targeted costs of various kinds.

 

Now for a dumb question. Many languages allow a form of setting a variable to a 
value like:

 

assign(var, 5+sin(x))

 

If we had a function that then returned var or the value of var, cleanly, then 
would that allow an end run on the walrus operator?

 

if (assign(sign, 5+sin(x)) <= assign(cosign, 5+cos(x))) …

 

Not necessarily pretty and I am sure there may well be reasons it won’t work, 
but I wonder if it will work in more places than the currently minimal walrus 
operator.

 

From: Antoon Pardon  
Sent: Thursday, October 28, 2021 3:03 AM
To: Avi Gross ; python-list@python.org
Subject: Re: New assignmens ...

 

 

Op 27/10/2021 om 20:20 schreef Avi Gross:

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.

 
Seperating costs from benefits doesn't mean costs are not an issue. It means
you don't deny de benefits because there are costs. Sure in the end the costs
may outweight the benefits but that is still not the same as there being no
benefits at all.
 
If you want to weight the costs against the benefits you need to acknowledge
both and not start by denying the benefits because you presume they will
not outweight the costs.
 
-- 
Antoon.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New assignmens ...

2021-10-28 Thread Chris Angelico
On Fri, Oct 29, 2021 at 4:37 AM Avi Gross via Python-list
 wrote:
> Now for a dumb question. Many languages allow a form of setting a variable to 
> a value like:
>
> assign(var, 5+sin(x))
>
> If we had a function that then returned var or the value of var, cleanly, 
> then would that allow an end run on the walrus operator?
>
> if (assign(sign, 5+sin(x)) <= assign(cosign, 5+cos(x))) …
>
> Not necessarily pretty and I am sure there may well be reasons it won’t work, 
> but I wonder if it will work in more places than the currently minimal walrus 
> operator.

For that to work, the language needs one of three things:

1) A way to pass an lvalue to a function, which it can then change
2) A form of pointer or reference (same thing, but you'd adorn it at
the call site - eg in C, you can write &var)
3) Magical compiler support for the assign function, so it isn't
really a function, just something that looks like one.

(Are there any other ways? I can't think of any.)

Python currently doesn't have any of those, so you'd have to pick
which one you're advocating for and show how it would be beneficial.
Personally, I'm dubious of all three, but I would be most interested
in the second option and its consequences.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The task is to invent names for things

2021-10-28 Thread Martin Di Paola

IMHO, I prefer really weird names.

For example if I'm not sure how to name a class that I'm coding, I name it
like XXXYYY (literally). Really ugly.

This is a way to avoid the so called "naming paralysis".

Once I finish coding the class I look back and it should be easy to see "what
it does" and from there, the correct name.

If the "what it does" results in multiple things I refactor it, splitting it
into two or more pieces and name each separately.

Some people prefer using more generic names like "Manager", "Helper",
"Service" but those names are problematic.

Yes, they fit in any place but that's the problem. If I'm coding a class and I
name it as "FooHelper", I may not realize later that the class is doing too
many things (unrelated things), because "it is a helper".

The thing gets wrong with the time; I bet that most of us saw a "Helper" class
with thousands of lines (~5000 lines was my record) that just grows over time.


On Wed, Oct 27, 2021 at 12:41:56PM +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 paralysis, one can start out with a mediocre name. In
  the course of time, often a better name will come to one's mind.


In that situation, is it preferable to choose a nonsensical
name over a mediocre one ?

Karsten
--
GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
--
https://mail.python.org/mailman/listinfo/python-list

--
https://mail.python.org/mailman/listinfo/python-list


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

2021-10-28 Thread Avi Gross via Python-list
Good points, Peter.

Although we are discussing Python, I think it would be reasonable to look a
bit more broadly.

Ages ago, IBM used a different encoding than ASCII called EBCDIC (Extended
Binary Coded Decimal Interchange Code ) which let them use all 8 bits and
thus add additional symbols. ±  ¦  ¬

So if you chose a specific set of symbols as a subset of UNICODE and
declared it to be PROGRAMMER symbols, it might be possible to provide
special keyboards that had something like the numeric keypad with a few more
symbols or in the place where the F1 keys are or wherever. All programming
languages that wished to use the symbols might be expected to mainly, or
exclusively, only use these symbols for unary or binary operators or other
purposes.

Look at one of the annoyances in Python (and similar in other languages)
where the matched symbols that come in left and right versions are overused.
() is used in oodles of contexts. So is {} and []. We do not use <> as
matching pairs because of other meanings. So a python dictionary and a
python set use the same general notation but can be disambiguated by the
contents sometimes. 

And I note that single and double quotes are currently unique while other
programs like WORD make them in pairs with a clear open and close quote
slanted differently. Would we be better able to write clear constructs if
our programs also clearly marked beginning and ends of text in some
contexts, perhaps allowing even things like nested text?

I have no idea of details here and clearly too many symbols is as bad as too
few. I have taken lots of courses in topics like mathematics and physics
where I was bombarded by all kinds of notations and symbols that forced me
to learn the Greek and other alphabets so I could sort of pronounce them in
my mind, as well as funny "script" letters and all kinds of invented symbols
including many you now find in a wingding section. So having an assortment
of these be the same as used by programmers might be good for others. Think
not just Greek letters that would also give you pi, but the Integral sign
the symbol used for partial derivatives and of course you need an aleph from
Hebrew :=)

Is there a reasonable extension to a keyboard that might be reasonable,
perhaps with an accommodation to those without such a keyboard so that
entering some sequence gets it converted into what you want on the screen
but more mnemonic than 0X234f ??

Now once there was some sort of standard developed, all IDE for all
languages might have the option to adopt it. Of course, some symbols would
not be used or allowed in a particular language, albeit if they were all
otherwise valid UNICODE symbols, would be allowed in other contexts such as
within text or perhaps in variable names.

But back to python, I am not suggesting that it would be wise to modify much
of what exists even if this was available. Sets and Dictionaries might
remain as is, or there might be a second optional way to use them with new
symbols.

I happen to be one of the people who reads/writes/speaks in multiple
languages. Many decades ago I was forced to switch encodings carefully to
say ISO-8859-1 (Latin 1) if I wanted to write properly in German but
Hungarian required ISO 8859-2 and Hebrew needed ISO 8859-8 and Japanese
needed others like Shift JIS. For a while, much of my work included being
able to take in text and perform conversions and it was a royal pain. If
everyone used a small set of common encoding, as in UNICODE, things get
easier from one perspective. What I am suggesting is not as drastic but that
we choose a set of symbols that are clear and unambiguous and not huge but
larger than what we have now and gradually migrate to using more of it.
Obviously brand new languages could be designed to use it and existing
languages MIGHT use it more for new features and extensions. 

So anyone know if anything like I am describing (or something much better)
is being looked at?



-Original Message-
From: Python-list  On
Behalf Of Peter J. Holzer
Sent: Thursday, October 28, 2021 5:08 AM
To: python-list@python.org
Subject: Re: walrus with a twist :+= or ...

On 2021-10-27 22:15:09 -0400, Avi Gross via Python-list wrote:
> 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 make use of them.

I have thought so since the 1990's.

But while the large variety of unicode symbols is great for displaying
programs, it is awful for entering them. Keyboards have a limited number of
keys (and those are fairly standardized, if a different standard in each
country), so you either have to combine several keys or need to pick
characters by a different method (e.g. the mouse). Both are cumbersome,
shift the attention of the programmer from the algorithm to the mechanics of
entry, and are different from editor to editor.

I sometimes use Greek letters in variable names. But I 

Re: Why so fast a web framework?

2021-10-28 Thread Calvin Spealman
I don't think there's anything meaningful being compared in that so-called
"benchmark" at all. There is no evidence that its worth even the smallest
bit of attention.

You want to write a web service? Do it. Use Python or PHP, or whatever you
prefer. Do you think your service is "slow"? You won't know until you
measure *your* service and compare that against actual requirements you
have. There is no context here to discuss performance and performance can
*only* be discussed in a context.

"SQL queries per second" is pointless. Why are you making so many SQL
queries? If you want your service to be more efficient, make fewer queries!

On Thu, Oct 28, 2021 at 12:49 PM Abdur-Rahmaan Janhangeer <
arj.pyt...@gmail.com> wrote:

> Me
>
> Like why exactly is that the case, i would not be surprised for rust, C,
> CPP etc
> But as to where the difference comes for two comparatively similar langs.
>
> Kind Regards,
>
> Abdur-Rahmaan Janhangeer
> about  | blog
> 
> github 
> Mauritius
>


-- 

CALVIN SPEALMAN

SENIOR QUALITY ENGINEER

calvin.speal...@redhat.com  M: +1.336.210.5107
[image: https://red.ht/sig] 
TRIED. TESTED. TRUSTED. 
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2021-10-28 Thread Chris Angelico
On Fri, Oct 29, 2021 at 5:53 AM Avi Gross via Python-list
 wrote:
> Is there a reasonable extension to a keyboard that might be reasonable,
> perhaps with an accommodation to those without such a keyboard so that
> entering some sequence gets it converted into what you want on the screen
> but more mnemonic than 0X234f ??

It's called Compose key sequences and they're supported by every
X11-based system, plus Windows and Mac OS if you set them up.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Get a Joke in Python

2021-10-28 Thread Mostowski Collapse
QA engineer walks into a bar. Orders a beer. Orders 0 beers. 
Orders 9 beers. Orders a lizard. Orders -1 beers.
Orders a sfdeljknesv.

LoL

joel.d...@gmail.com schrieb am Mittwoch, 27. Oktober 2021 um 21:00:29 UTC+2:
> 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 — ‘it’ 
> German — ‘de’ Galician — ‘gl’ Basque — ‘eu’ Categories Included In Pyjokes 
> For geeky jokes -’neutral’ (It is chosen by default) For Chris Norris Jokes — 
> ‘chuck’. If you want all type of jokes — ‘all’ There is one more category 
> known as ‘twister’ which only works for the German Language (‘de’) and mostly 
> includes tongue twister. Read the documentation available on https://pyjok.es 
> for more info. :::Lets Code::: Install pyjokes if you haven't pip install 
> pyjokes This Program will give you one-liner Joke #pip install pyjokes # 
> importing module i 
> [Read More...] 
> 
> https://pysnakeblog.blogspot.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why so fast a web framework?

2021-10-28 Thread Chris Angelico
On Fri, Oct 29, 2021 at 6:17 AM Calvin Spealman  wrote:
>
> I don't think there's anything meaningful being compared in that so-called
> "benchmark" at all. There is no evidence that its worth even the smallest
> bit of attention.
>
> You want to write a web service? Do it. Use Python or PHP, or whatever you
> prefer. Do you think your service is "slow"? You won't know until you
> measure *your* service and compare that against actual requirements you
> have. There is no context here to discuss performance and performance can
> *only* be discussed in a context.
>
> "SQL queries per second" is pointless. Why are you making so many SQL
> queries? If you want your service to be more efficient, make fewer queries!
>

In my experience, using PostgreSQL, a more viable metric is
"transactions per second" - throughput is very similar regardless of
the number of queries per transaction. As a general rule, a web
service should be doing at most one transaction per query, so
throughput in requests per second will be equal to transactions per
second plus however many can be returned from cache (which, for some
applications, will be zero).

Sadly, many people still bow down in worship at the little tin god,
while completely ignoring the fact that proper transactional integrity
will improve *business* performance by, yaknow, not losing data... and
it still often works out faster than doing things wrongly.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Get a Joke in Python

2021-10-28 Thread Chris Angelico
On Fri, Oct 29, 2021 at 7:31 AM Mostowski Collapse  wrote:
>
> QA engineer walks into a bar. Orders a beer. Orders 0 beers.
> Orders 9 beers. Orders a lizard. Orders -1 beers.
> Orders a sfdeljknesv.
>

Orders 1 пиво and is served a пиво. QA engineer sighs "not again".

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: The task is to invent names for things

2021-10-28 Thread Avi Gross via Python-list
Stefan,

I choose not to get involved in a discussion about arbitrary naming rules as 
many languages and programmers have their own ideas and preferences and rules.

My examples were EXAMPLES and the actual names are irrelevant. Feel free not to 
use them and I assure you I have no plans to either.

My POINT was that people choose names as being descriptive in many ways, often 
unique to themselves or to their organizations. A name that may be considered 
quite useful and explanatory in one context is not in another. Specifically, 
names chosen using American English may mean little if looked at by programmers 
elsewhere or if they are chosen with a sense of humor or the like, may not make 
sense to those who are not in on the ideas involved. Naming a variable PINK (in 
any combination of upper or lower case you feel like may make you think it fits 
when using it to count Breast Cancer patients but many will have no idea why 
you chose that.

I strenuously disagree with many things you quote as being obviously true. 
Nonsense! Programs need whatever number of variables they need. There is no 
reason you must reuse the same variable of "i" or "index" for every loop nor 
why it must be different every time. Nor must names lengths be determined by 
the length of scopes. You are quoting, presumably, from some document outlining 
what a corporation or University or such are doing to try to get a consistency 
across their programmers. Fine, I have seen multiple CONTRADICTORY such 
declarations and it is often a matter of taste. In some languages I use periods 
in longer variable names and in others I use underscores and many times I use 
camelCase, Hungarian notation and others. The compiler and interpreter 
generally do NOT care.

To bring this back to python, does it have any serious rules or informal ones 
as compared to others? I have seen places that suggest constants be all CAPS 
and Classes should be capitalized and regular variables never capitalized and 
endless variations on such themes. I have seen places they suggest adding parts 
to names such as the units so you have xxxDollars versus xxxFeet or where they 
want each variable to contain a similar suffix (or prefix) specifying the type 
of the object such as int or char or objectXY as one way to make things clearer 
or help prevent errors. There are MANY schools of thought and I suggest no one 
right way.

My thought was that no matter what methodology for naming you have, it may not 
work quite well if the same variable is used in contexts ranging from does it 
currently exist, how much does it hold, is it "true" as in non-empty, or the 
value it has when switched to another form of measurement. It is common often 
to encapsulate something into an object and then use instance variables or 
functions to address it different ways. So an object called incomedata might be 
used as incomedata.count in one context and incomedata.nonempty() in another. 
That is not the same as my talking about synonyms. And note many languages 
allow you to create somewhat dynamic synonyms such as a view of a subset of 
something like an array using another variable and allowing it to represent the 
current state of the main data structure or even change selected parts. It is 
not at all a foreign concept to have multiple names point to the same things. 
Often, it helps make the code clearer.



-Original Message-
From: Python-list  On 
Behalf Of Stefan Ram
Sent: Thursday, October 28, 2021 2:07 PM
To: python-list@python.org
Subject: Re: The task is to invent names for things

Supersedes: 
[corrected two typos]

"Avi Gross"  writes:
>if (WeHaveAny)

|Function names should be lowercase, with words separated by underscores 
|as necessary to improve readability.
|Variable names follow the same convention as function names.
PEP 8 (2019)

  The name should not be "optimized" for a certain use case
  (as for the use in an if expression) only. "We", "have",
  and "any" carry little information. A name should pack as
  much information as possible in as least characters as
  possible. So, for me, it'd be something like:

if word_count:

  .

>So, the obvious solution is to ask the language, like Python, to allow 
>variables that are synonyms.

  Programs already have too many names in them. 
  There is no need to add even more, especially
  when they are equivalent, and the average human can
  only hold 7 ± 2 objects (like names) in his short-
  term memory.

>really good names often end up being really long names

  If they are really long, they are not really good,
  /except/ when they have a really large scope.

  Names for a small scope can and should be short,
  names for a large scope may be longer.

  Some very short names have traditional meanings
  and are ok when used as such:

for i in range( 10 ):

  . And, as a "golden rule" for refactoring, I'd say:
  When you see:

i = 0 # word count

  , then remove the comment and rename "i" to "word_count"!


--
https://

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

2021-10-28 Thread Avi Gross via Python-list
Thank, Chris. I found and installed one from here: 
https://github.com/samhocevar/wincompose

My right ALT key now lets me type in all kinds of nonsense like ⑦ and © and ß 
and ℵ0 and ⅔  and ≠ and ⇒ and ♬and although :- makes ÷ I see :=  makes ≔ which 
is just a longer equals sign.


Not sure this mailing list allows this stuff, so if your mailer does not show 
it, never mind.

Now I have to locate the list of available sequences as the built-in does not 
show many I want to se and I have already guessed some!

And, yes, as long as the list of additional program symbols is easily 
available, that should do even on standard keyboards.

∴

-Original Message-
From: Python-list  On 
Behalf Of Chris Angelico
Sent: Thursday, October 28, 2021 3:24 PM
To: Python 
Subject: Re: walrus with a twist :+= or ...

On Fri, Oct 29, 2021 at 5:53 AM Avi Gross via Python-list 
 wrote:
> Is there a reasonable extension to a keyboard that might be 
> reasonable, perhaps with an accommodation to those without such a 
> keyboard so that entering some sequence gets it converted into what 
> you want on the screen but more mnemonic than 0X234f ??

It's called Compose key sequences and they're supported by every X11-based 
system, plus Windows and Mac OS if you set them up.

ChrisA
--
https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Get a Joke in Python

2021-10-28 Thread Greg Ewing

On 29/10/21 11:34 am, Chris Angelico wrote:

On Fri, Oct 29, 2021 at 7:31 AM Mostowski Collapse  wrote:


QA engineer walks into a bar. Orders a beer. Orders 0 beers.
Orders 9 beers. Orders a lizard. Orders -1 beers.
Orders a sfdeljknesv.



Orders 1 пиво and is served a пиво. QA engineer sighs "not again".


Orders NaN beers and 

--
Greg


--
https://mail.python.org/mailman/listinfo/python-list


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

2021-10-28 Thread Grant Edwards
On 2021-10-28, Avi Gross via Python-list  wrote:

> I see := makes ≔ which is just a longer equals sign.

On my screen it's an assignment operator that looks like := only a bit
smaller.

> Not sure this mailing list allows this stuff, so if your mailer does
> not show it, never mind.

Everything renders fine for me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Get a Joke in Python

2021-10-28 Thread Jon Ribbens via Python-list
On 2021-10-28, Greg Ewing  wrote:
> On 29/10/21 11:34 am, Chris Angelico wrote:
>> On Fri, Oct 29, 2021 at 7:31 AM Mostowski Collapse  
>> wrote:
>>> QA engineer walks into a bar. Orders a beer. Orders 0 beers.
>>> Orders 9 beers. Orders a lizard. Orders -1 beers.
>>> Orders a sfdeljknesv.
>>>
>> 
>> Orders 1 пиво and is served a пиво. QA engineer sighs "not again".
>
> Orders NaN beers and 

The variant of this I saw the other day follows the above and after
the QA engineer has ordered various things it follows:

  A real customer walks into the bar and doesn't order anything,
  but asks where the toilets are.

  The bar explodes in flames.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Get a Joke in Python

2021-10-28 Thread Chris Angelico
On Fri, Oct 29, 2021 at 12:29 PM Jon Ribbens via Python-list
 wrote:
>
> On 2021-10-28, Greg Ewing  wrote:
> > On 29/10/21 11:34 am, Chris Angelico wrote:
> >> On Fri, Oct 29, 2021 at 7:31 AM Mostowski Collapse  
> >> wrote:
> >>> QA engineer walks into a bar. Orders a beer. Orders 0 beers.
> >>> Orders 9 beers. Orders a lizard. Orders -1 beers.
> >>> Orders a sfdeljknesv.
> >>>
> >>
> >> Orders 1 пиво and is served a пиво. QA engineer sighs "not again".
> >
> > Orders NaN beers and 
>
> The variant of this I saw the other day follows the above and after
> the QA engineer has ordered various things it follows:
>
>   A real customer walks into the bar and doesn't order anything,
>   but asks where the toilets are.
>
>   The bar explodes in flames.

... and the owner just bulldozes the bar, builds a new one on the same
spot, and pretends nothing happened.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why so fast a web framework?

2021-10-28 Thread Dan Stromberg
I care, and I suspect the OP does too.  Usually machine time doesn't matter
as much as developer time, but API overhead Can matter - especially on a
busy server.

I wonder if Pypy would do any better?  Or Micropython?  Or Cython?

CPython != Python.

Sometimes this group reminds me of a certain large company I worked for.
If they didn't have a solution addressing a problem, they'd pretend it
didn't matter and belittle anyone who questioned that version of reality.


On Thu, Oct 28, 2021 at 9:46 AM Calvin Spealman  wrote:

> Who cares?
>
> On Wed, Oct 27, 2021 at 10:47 PM Abdur-Rahmaan Janhangeer <
> arj.pyt...@gmail.com> wrote:
>
> > @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
> >
> >
>
> --
>
> CALVIN SPEALMAN
>
> SENIOR QUALITY ENGINEER
>
> calvin.speal...@redhat.com  M: +1.336.210.5107
> [image: https://red.ht/sig] 
> TRIED. TESTED. TRUSTED. 
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why so fast a web framework?

2021-10-28 Thread Chris Angelico
On Fri, Oct 29, 2021 at 3:49 PM Dan Stromberg  wrote:
>
> I care, and I suspect the OP does too.  Usually machine time doesn't matter
> as much as developer time, but API overhead Can matter - especially on a
> busy server.
>
> I wonder if Pypy would do any better?  Or Micropython?  Or Cython?
>
> CPython != Python.
>
> Sometimes this group reminds me of a certain large company I worked for.
> If they didn't have a solution addressing a problem, they'd pretend it
> didn't matter and belittle anyone who questioned that version of reality.
>

That's not strictly true; what's happening here is that someone's
published a cool-looking bar graph but nobody knows what it really
means. I don't feel the need to delve into everyone's benchmarks to
explain why Python is purportedly worse. If someone uses those kinds
of numbers to decide which programming language to use, they have
bigger problems.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: New assignmens ...

2021-10-28 Thread Antoon Pardon




Op 28/10/2021 om 19:36 schreef Avi Gross via Python-list:

Antoon,

  
You keep beating a dead horse. NOBODY denies there are benefits to suggestions like the one we are describing. It is a logical fallacy to keep arguing this way.


Please point to the specific logical falacy you think I am commiting. Don't 
hand wave about what I supposedly
am doing.


And nobody (meaning me) suggests costs are a dominant factor in decisions no 
matter the benefits. The realistic suggestion is to not only weight costs and 
benefits for one proposal but for all reasonable proposals and then choose.


So what if *you* don't suggest that. Others have. Then when I responded to 
those with a remark about seperating
costs and benefits, you budded in with the assertion that those who suggest 
seperating benefits and cost belong
in the accademic world because you understood that remark as implying costs are 
not as issue. I then explain you
misunderdood en now you come with the above.

Maybe you should be more aware of the history of a thread before coming with 
this kind of statements.

--
Antoon Pardon
--
https://mail.python.org/mailman/listinfo/python-list


Re: Why so fast a web framework?

2021-10-28 Thread Abdur-Rahmaan Janhangeer
Well,

They don't choose languages per se but choose frameworks based on that
and ... by virtue of that choose languages. Like just to get faster web
services.

The benchmark is pretty much referred to in the Python world, web side like

https://www.starlette.io/
"Independent TechEmpower benchmarks show Starlette applications running
under Uvicorn as one of the fastest Python frameworks available. (*)"

https://github.com/tiangolo/fastapi
... (thanks to Starlette and Pydantic). One of the fastest Python
frameworks available.

Both with links to the benchmarks.

So, while non-web folks don't care, web folks seem to care. And as a web
someone i wanted to know
why is that so.

Kind Regards,

Abdur-Rahmaan Janhangeer
about  | blog

github 
Mauritius
-- 
https://mail.python.org/mailman/listinfo/python-list