Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
I agree with Richard. Some people may be confused and think c is the speed of light and relativistically speaking, nothing can be faster. (OK, just joking. The uses of the same letter of the alphabet are not at all related. One is named for the language that came after the one named B, while th

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
Is that fair, Grant? I go back far enough that in my earliest years I was submitting FORTRAN programs written on punched cards and often getting them back the next day. The compiling was not the major factor in how long it took. For many cases, a compiled language only needs to be compiled once

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
Dennis, What you describe may be a start but is it anything I might not have easily created myself? https://docs.python.org/3/library/array.html I can see creating my own object and adding those methods and attributes while gaining very little, except perhaps storage. Can I add or multiply tw

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
g on the same language, Python? -Original Message- From: Chris Angelico To: python-list@python.org Sent: Fri, Feb 25, 2022 2:58 pm Subject: Re: C is it always faster than nump? On Sat, 26 Feb 2022 at 06:44, Avi Gross via Python-list wrote: > > I agree with Richard. > > Some people m

Re: C is it always faster than nump?

2022-02-25 Thread Avi Gross via Python-list
problems. -Original Message- From: Chris Angelico To: python-list@python.org Sent: Fri, Feb 25, 2022 11:16 pm Subject: Re: C is it always faster than nump? On Sat, 26 Feb 2022 at 14:35, Avi Gross via Python-list wrote: > But with numpy and more available anyway, it may not be necessary

Re: All permutations from 2 lists

2022-03-02 Thread Avi Gross via Python-list
Larry, i waited patiently to see what others will write and perhaps see if you explain better what you need. You seem to gleefully swat down anything offered. So I am not tempted to engage. Some later messages suggest you may not be specifying quite what you want. It sounds like you are asking

Re: All permutations from 2 lists

2022-03-03 Thread Avi Gross via Python-list
It is clear that was not quite your real need. -Original Message- From: Larry Martell To: Avi Gross Cc: python-list@python.org Sent: Thu, Mar 3, 2022 9:07 am Subject: Re: All permutations from 2 lists On Wed, Mar 2, 2022 at 9:42 PM Avi Gross via Python-list wrote: > >

Re: Timezone jokes (was: All permutations from 2 lists)

2022-03-03 Thread Avi Gross via Python-list
Chris and others, This is a bit off-topic, but for anyone who saw the recent remake of Around The World in 80 days (and of course earlier versions including the book) will see that it too is a sort of timezone joke! The timezone taketh away and then giveth. -Original Message- From: Ch

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
The drumbeat I keep hearing is that some people hear/see the same word as implying something else. ELSE is ambiguous in the context it is used. And naturally, since nobody desperately wants to use non-reserved keywords, nobody seems ready to use a word like INSTEAD instead. Ideally, a language

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
been better if it had been spelt `nobreak` or similar in the first place. Rob Cliffe On 03/03/2022 23:07, Avi Gross via Python-list wrote: > The drumbeat I keep hearing is that some people hear/see the same word as > implying something else. ELSE is ambiguous in the context it is used. > >

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
n NEVERTHELESS. -Original Message- From: Chris Angelico To: python-list@python.org Sent: Thu, Mar 3, 2022 7:34 pm Subject: Re: Behavior of the for-else construct On Fri, 4 Mar 2022 at 10:09, Avi Gross via Python-list wrote: > > The drumbeat I keep hearing is that some people h

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
hen you die and it simplifies. -Original Message- From: Rob Cliffe via Python-list To: python-list@python.org Sent: Thu, Mar 3, 2022 8:41 pm Subject: Re: Behavior of the for-else construct On 04/03/2022 00:38, Avi Gross via Python-list wrote: > Rob, > > I regularly code with l

Re: Behavior of the for-else construct

2022-03-03 Thread Avi Gross via Python-list
That is one way to look at it, Jach. Of course, a particular loop may have multiple break statements each meaning something else. The current implementation makes all of them jump to the same ELSE statement so in one sense, I consider the ELSE to be associated with the loop as a whole. Sometimes

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
Dieter, Your use is creative albeit it is not "needed" since all it does is make sure your variable is initialized to something, specifically None. So would this not do the same thing? eye = None for eye in range(0): print(eye) eye If I understand it, your example depends on a va

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
{NOTE, after some diversion, this long message does revert a bit to the topic.} Ah, Chris, the games we played when we were young and relatively immature! Has anyone else played with embedding "escape sequences" or other gimmicks in unexpected places like filenames so that on the right terminals

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
nal Message- From: Chris Angelico To: python-list@python.org Sent: Fri, Mar 4, 2022 12:47 pm Subject: Re: Behavior of the for-else construct On Sat, 5 Mar 2022 at 03:44, Avi Gross via Python-list wrote: > > Dieter, > > Your use is creative albeit it is not "needed" since

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
lows something like: result = for ... That might return 0 or None if it was part of the language but it is not. Avi (my current first name) -Original Message- From: Om Joshi To: Avi Gross Cc: python-list Sent: Fri, Mar 4, 2022 3:04 pm Subject: Re: Behavior of the for-else constru

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
To: python-list@python.org Sent: Fri, Mar 4, 2022 5:22 pm Subject: Re: Behavior of the for-else construct On 04/03/2022 20:52, Avi Gross via Python-list wrote: > > I have an observation about exception handling in general. Some people use > exceptions, including ones they create and t

Re: Behavior of the for-else construct

2022-03-04 Thread Avi Gross via Python-list
hon-list@python.org Sent: Fri, Mar 4, 2022 5:57 pm Subject: Re: Behavior of the for-else construct On 2022-03-04 00:38:22 +0000, Avi Gross via Python-list wrote: > I have seen major struggles to get other character sets into > languages. Any new language typically should have this built in from > s

Re: Behavior of the for-else construct

2022-03-05 Thread Avi Gross via Python-list
Since we still seem to be dreaming, I wonder when someone will suggest using some variation of the new match statement. All you need is for the for loop (and possibly other such constructs) to return some kind of status that can be matched match (for var in something: ... ) :

Re: Behavior of the for-else construct

2022-03-05 Thread Avi Gross via Python-list
To: python-list@python.org Sent: Sat, Mar 5, 2022 1:39 pm Subject: Re: Behavior of the for-else construct On 04/03/2022 18.11, Peter J. Holzer wrote: > On 2022-03-04 23:47:09 +0000, Avi Gross via Python-list wrote: >> I am not sure a reply is needed, Peter, and what you say is true. But

Re: Behavior of the for-else construct

2022-03-05 Thread Avi Gross via Python-list
and other languages to undergrads ;-) -Original Message- From: Dennis Lee Bieber To: python-list@python.org Sent: Sat, Mar 5, 2022 7:00 pm Subject: Re: Behavior of the for-else construct On Sat, 5 Mar 2022 21:40:08 + (UTC), Avi Gross declaimed the following: >I am not sure how we end

Re: Behavior of the for-else construct

2022-03-06 Thread Avi Gross via Python-list
of the for-else construct On 2022-03-06 09:29:19 -0800, Grant Edwards wrote: > On 2022-03-05, Avi Gross via Python-list wrote: > > I am not sure how we end up conversing about PASCAL on a Python > > forum. > > [...] > > I paid no attention to where PASCAL was being used

Re: for convenience

2022-03-21 Thread Avi Gross via Python-list
Chris, I think you understood the context but not the premise in a sense that wasin the way Paul was thinking. His premise is way off He seems to be thinking of something like a macro concept as iscommonly used in languages like C so: #define context bpy.context That could, in such languages, use

convenience

2022-03-22 Thread Avi Gross via Python-list
An earlier post talked about a method they used for "convenience" in a way they apparently did not understand and many of us educated them, hopefully. That made me wonder of teh impact on our code when we use various forms of convenience. Is it convenient for us as programmers, other potential re

Re: for convenience

2022-03-22 Thread Avi Gross via Python-list
ent: Tue, Mar 22, 2022 4:52 pm Subject: Re: for convenience On 21/03/2022 17.47, Avi Gross wrote: > So, I ask Paul what other language than python he has used before, just out > of curiosity. The other language I have used (and often) is Processing. Before that, and a long time ago, Lingo.

Re: convenience

2022-03-22 Thread Avi Gross via Python-list
suggestion that unless you know the code well and can be sure you won't corrupt things, this kind of convenient access has possible dangers. -Original Message- From: Greg Ewing To: python-list@python.org Sent: Tue, Mar 22, 2022 7:12 pm Subject: Re: convenience On 23/03/22 7:00 am, Avi

Re: for convenience

2022-03-24 Thread Avi Gross via Python-list
Hopefully, adding to what Dave said, it helps to understand there often are choices and tradeoffs in everything and in particular to language design. And choices propagate so that making choice A and B may box you in so at some point choice Z is pretty much forced unless you start over and make o

Re: for convenience

2022-03-24 Thread Avi Gross via Python-list
Original Message- From: Chris Angelico To: python-list@python.org Sent: Thu, Mar 24, 2022 1:37 pm Subject: Re: for convenience On Fri, 25 Mar 2022 at 04:15, Avi Gross via Python-list wrote: > Python made lots of choices early on and then tried to graft on ever more > features

Re: for convenience

2022-03-24 Thread Avi Gross via Python-list
xample, which I sometimes use in my programming, literally jumps out of the initial language. -Original Message- From: Chris Angelico To: python-list@python.org Sent: Thu, Mar 24, 2022 1:37 pm Subject: Re: for convenience On Fri, 25 Mar 2022 at 04:15, Avi Gross via Python-list wrote: &g

Re: for convenience

2022-03-24 Thread Avi Gross via Python-list
for a programming class and it definitely would have been much easier to do in Python. -Original Message- From: Chris Angelico To: python-list@python.org Sent: Thu, Mar 24, 2022 7:57 pm Subject: Re: for convenience On Fri, 25 Mar 2022 at 10:44, Avi Gross wrote: > But would it

Re: How to detect an undefined method?

2022-03-27 Thread Avi Gross via Python-list
The question seems to be how or whether you can check Python code in advance for any instances of a method for an object being called that is not instantiated. Right? As Kirill points out, Python can be quite dynamic. I can think of oodles of ways checking would not work well in a static examinati

Re: dict.get_deep()

2022-04-03 Thread Avi Gross via Python-list
I may have misunderstood something. The original post in this subject sounded to ME likethey had nested dictionaries and wanted to be ableto ask a method in the first dictionary totake an unspecified number of arguments thatwould be successive keys and return the results. I mean if A was a dicti

Re: dict.get_deep()

2022-04-04 Thread Avi Gross via Python-list
embedded solution like operator ? or ??. For example deep dict extraction could look like: street = data["users"]?[0]?["address"]?["street"]?. // BR 04.04.2022 2:24, Avi Gross via Python-list пишет: > I may have misunderstood something. > The original post

Re: code confusion

2022-04-15 Thread Avi Gross via Python-list
As usual, without very clear and precise instructions and parameters, the answers may not quite fit. It looks like you are asked two and only two questions. The first is asking how many numbers you want.  Before continuing, you need to make sure that is a valid number as many answer will throw a

RE: Generating generations of files

2019-04-30 Thread Avi Gross via Python-list
TOPIC: how to save, retain and retrieve files as they change. There seem to be several approaches and one proposal here involved using altered file names with a numeric suffix. Can we compare two different concepts? A typographical approach with little or no built-in support like searching for a

RE: More CPUs doen't equal more speed

2019-05-23 Thread Avi Gross via Python-list
Bob, As others have noted, you have not made it clear how what you are doing is running "in parallel." I have a similar need where I have thousands of folders and need to do an analysis based on the contents of one at a time and have 8 cores available but the process may run for months if run lin

RE: Most elegant way to do something N times

2019-12-23 Thread Avi Gross via Python-list
I would like some examples of how one does what is requested in some other programming languages. I doubt there is much need of a shorter way to do anything N times and throw away any return values. Python has many ways to do just about anything. It has some features which suggest a particular way

RE: Most elegant way to do something N times

2019-12-23 Thread Avi Gross via Python-list
What others have answered is tangential. Nobody doubts there are places where you want to repeat something N times. Just to add an example, if you are parsing something nested by parentheses or perhaps HTML, and you reach a point where you have seen N opening symbols and start seeing a closing symb

RE: Lists And Missing Commas

2019-12-24 Thread Avi Gross via Python-list
As a purist, it makes people uncomfortable if all 'objects' are not treated alike. But I look at the question from a definition and parsing mechanism view. When an interpreter (or compiler) reads a program, it often does it in phases and tries to tokenize parts. So, the definition of something o

Lists And Extra Commas at end

2019-12-24 Thread Avi Gross via Python-list
nly drive vehicles with 4 or six tires, LOL! -Original Message- From: forwarde...@e4ward.com On Behalf Of Marco Sulla Sent: Tuesday, December 24, 2019 4:03 PM To: Avi Gross Cc: python-list.python.org-mail.python.org.marco.sulla.e4ward@jq38efsu937.reply.e4ward.com Subject: Re: Lists A

RE: Lists And Extra Commas at end

2019-12-24 Thread Avi Gross via Python-list
convenience is in some sense removing a mathematical symmetry, but so what? -Original Message- From: Cameron Simpson Sent: Tuesday, December 24, 2019 5:12 PM To: Avi Gross Cc: python-list@python.org Subject: Re: Lists And Extra Commas at end On 24Dec2019 16:48, Avi Gross wrote: >

RE: Technical debt - was Re: datetime seems to be broken WRT timezones (even when you add them)

2020-02-12 Thread Avi Gross via Python-list
I have to wonder if this is a bit like what happens when something like Windows offers you an upgrade if you pay for it. Some people have noticed how after such things come out, a series of rapid bug fixes come along. So, they wait. Some wait long enough until another entire version has come along

RE: Puzzling difference between lists and tuples

2020-09-20 Thread Avi Gross via Python-list
There is a simple and obvious way to make sure you have a tuple by invoking the keyword/function in making it: >>> a=('first') >>> type(a) >>> a=("first",) >>> type(a) >>> a=tuple("first") >>> type(a) That seems more explicit than adding a trailing comma. It also is a simple way to make an

RE: Puzzling difference between lists and tuples

2020-09-20 Thread Avi Gross via Python-list
iterator is iterating at a different level. >>> d = ["first"] >>> tuple(d) ('first',) >>> tuple(["first"]) ('first',) I understand the design choice and can imagine there may be another function that initializes a tuple more directly in

RE: Use of a variable in parent loop

2020-09-27 Thread Avi Gross via Python-list
These discussions can be bit frustrating. People talk past each other. Languages seem almost like religions, as do paradigms. I try to stay above it and absorb each paradigm as an alternative choice made and then try to think of what problems I can solve better with one or another and so on. P

RE: Python's carbon guilt

2020-10-10 Thread Avi Gross via Python-list
People have a tendency to go too far in their religious zeal, Peter. We could go back to writing on chalkboards to do calculations then re-use the chalk dust when erasing to write again. Many computers do almost nothing 90+ percent of the time. Want to outlaw those or force them to accept random

RE: Find word by given characters

2020-11-03 Thread Avi Gross via Python-list
I, too, have wondered what exactly the point was of the required functionality for SCRABBLE but note you can extend a current word so additional letters may be available in a game but only if they are an exact fit to put before, after, or in middle of your word. But this seems to be a fairly simp

RE: Find word by given characters

2020-11-03 Thread Avi Gross via Python-list
Duncan, my comments below yours at end. ---YOURS--- The Counter approach only requires iterating over the letters once to construct the letters bag, then each word once to create the relevant word bag. After that it's (at worst) a couple of lookups and a comparison for each unique character in let

RE: Find word by given characters

2020-11-04 Thread Avi Gross via Python-list
My comments at end: -Original Message- From: Python-list On Behalf Of duncan smith Sent: Wednesday, November 4, 2020 1:09 PM To: python-list@python.org Subject: Re: Find word by given characters On 04/11/2020 04:21, Avi Gross wrote: > Duncan, my comments below yours at

RE: Returning from a multiple stacked call at once

2020-12-12 Thread Avi Gross via Python-list
As always, it may be useful to know WHY the questioner wants to skip intermediate functions already in progress and jump back to some unspecified earlier level. There is a reason why functions are "stacked" and there are data structures that really may need to be unwound. But if the question is no

RE: How do you find what exceptions a class can throw?

2020-12-20 Thread Avi Gross via Python-list
The original question sounded like someone was asking what errors might be thrown for a routine they wrote that used other components that might directly throw exceptions or called yet others, ad nauseum. Some have questioned the purpose. I can well imagine that if such info was available, you co

RE: How do you find what exceptions a class can throw?

2020-12-21 Thread Avi Gross via Python-list
: Monday, December 21, 2020 4:06 AM To: python-list@python.org Subject: Re: How do you find what exceptions a class can throw? Avi Gross wrote: > The original question sounded like someone was asking what errors > might be thrown for a routine they wrote that used other components > t

RE: Which method to check if string index is queal to character.

2020-12-28 Thread Avi Gross via Python-list
This may be a nit, but can we agree all valid email addresses as used today have more than an @ symbol? I see it as requiring at least one character before the @ that come from a list of allowed characters (perhaps not ASCII) but does not include the symbol @ again. It is normally followed by some

RE: Which method to check if string index is queal to character.

2020-12-28 Thread Avi Gross via Python-list
. Dropping out, ... -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Monday, December 28, 2020 8:02 PM To: Python Subject: Re: Which method to check if string index is queal to character. On Tue, Dec 29, 2020 at 10:08 AM Avi Gross via Python-list wrote: > > This

RE: A problem with str VS int.

2023-12-09 Thread AVI GROSS via Python-list
Steve, I would say converting to a number, as you eventually did, is the way to go. When you compare character strings, it will not be in numeric order. Compare "80" with "400" and since 8 is greater than 4, the comparison is over and "80" is greater then "40" even though 80 is way less than 400.

RE: A problem with str VS int.

2023-12-12 Thread AVI GROSS via Python-list
Roel, I sent a similar reply in private to someone who may not be listening as their mind is made up. This points to a serious problem with people not testing hypotheses adequately. Perhaps for homework, we can assign a request for a Python program that creates a random sample of quite a few d

RE: Extract lines from file, add to new files

2024-01-12 Thread AVI GROSS via Python-list
If the data in the input file is exactly as described and consists of alternating lines containing a name and email address, or perhaps an optional blank line, then many solutions are possible using many tools including python programs. But is the solution a good one for some purpose? The two outp

RE: Extract lines from file, add to new files

2024-01-14 Thread AVI GROSS via Python-list
It can be worth considering why a language is designed or altered in certain ways to see if there was a tradeoff that made it seem worthwhile or easier than some other choice. Python grew and there was regular pressure to add keywords which might break existing programs. So, yes, sometimes, a keyw

RE: Extract lines from file, add to new files

2024-01-14 Thread AVI GROSS via Python-list
Chris, It gets frustrating when people demand too much when strictly speaking, it is not really needed or may cause new problems. How often do you really think anyone out there NEEDS to define a function in the context mentioned? You provided a way to create an anonymous function and that was no

RE: Extract lines from file, add to new files

2024-01-14 Thread AVI GROSS via Python-list
Straight Ahead, on average, I am not sure what your beef is as apparently it is always something else than some others assumed. If your point is that you want consistency, sure that would be nice. But maybe part of the inconsistency I am not sure you mean is an artifact of the language. There

RE: Extract lines from file, add to new files

2024-01-14 Thread AVI GROSS via Python-list
Whoa, Олег Сивоконь! I do not understand any arguments about whether comments are, or are not an object. From one perspective, python comments have even less meaning than whitespace and simply do not exist. I mean once a naked "#" is seen, the rest of that line is effectively discarded by the int

RE: extend behaviour of assignment operator

2024-01-19 Thread AVI GROSS via Python-list
Guenther, It is best not to suggest a drastic fix for a more limited problem. As a general rule, many programming languages only have a pointer concept even vaguely along the lines you want for garbage collection purposes. An area of memory may have stored alongside it how many other things point

RE: Extract lines from file, add to new files

2024-01-29 Thread AVI GROSS via Python-list
Rich, You got an overly general reply to a question many of us may not understand. You have not hinted at how the two files are organized, perhaps with an example. There are several general solutions that may apply. Some involve reading in both files into data structures and perhaps linking them

RE: Extract lines from file, add to new files

2024-01-29 Thread AVI GROSS via Python-list
It can be quite frustrating figuring out what someone wants, Grant, especially when they just change it. It is worse when instead of starting a new thread with an appropriate subject line, it continues and old one that was also frustrating to understand. It sounds though like another attempt to d

RE: Extract lines from file, add to new files

2024-01-30 Thread AVI GROSS via Python-list
I deleted the contents of the message so I can avoid both of the deadly sins of top posting and bottom posting and chance committing the sin of replying without any context. Of course, I am only replying to Jon wishing a real or feigned good luck to the OP. But seriously, the OP, AKA Rich, is m

RE: Aw: Re: Extract lines from file, add to new files

2024-01-30 Thread AVI GROSS via Python-list
Rich, You may want to broaden your perspective a bit when people make suggestions. Karsten did not spell out a full design and should not need to. But consider this as a scenario. You want to send (almost) the same message to one or more recipients. So call a program, perhaps some variant on a

RE: Extract lines from file, add to new files

2024-01-30 Thread AVI GROSS via Python-list
Thomas, on some points we may see it differently. Some formats can be done simply but are maybe better done in somewhat standard ways. Some of what the OP has is already tables in a database and that can trivially be exported into a CSV file or other formats like your TSV file and more. They can

RE: Extract lines from file, add to new files

2024-02-03 Thread AVI GROSS via Python-list
This discussion has circled back to where it started. It illustrates quite a few points about how many different ways someone can do something as well as doing it using different tools and also about how others may see aspects of mission creep as they look for making it perfect when it need not be.

RE: Extract lines from file, add to new files

2024-02-03 Thread AVI GROSS via Python-list
Thomas, I have been thinking about the concept of being stingy with information as this is a fairly common occurrence when people ask for help. They often ask for what they think they want while people like us keep asking why they want that and perhaps offer guidance on how to get closer to what t

RE: Extract lines from file, add to new files

2024-02-03 Thread AVI GROSS via Python-list
We substantially agree with that, Thomas. In the best of all possible worlds, someone who gets stuck will sit down and try to carefully spell out things in ways like you mention and, incidentally, may often catch the error or figure out how to do it and not even send in a request! LOL! I think a

RE: Extract lines from file, add to new files

2024-02-03 Thread AVI GROSS via Python-list
Dave, You and I have had some experience in teaching or tutoring others and I think it fair to say our motivation is closer to teaching someone how they can fish for themselves rather than just handing them a fully-cooked fish. My favorite kinds of questions, thus, include someone who explains

RE: Configuring an object via a dictionary

2024-03-15 Thread AVI GROSS via Python-list
A part of the Python view of the world is about a concept of whether something is "truthy" or not and thus many corners of the language do not care what kind of object an expression returns. If the object is returned in a context looking for not a Boolean value but a truth value, it is evaluated an

RE: Configuring an object via a dictionary

2024-03-17 Thread AVI GROSS via Python-list
If we are bringing up other languages, let's return to what was part of the original question. How van a dictionary be used in python if your goal is to sort of use it to instantiate it into a set of variables and values inside the local or global or other namespaces? Can we learn anything from

RE: Popping key causes dict derived from object to revert to object

2024-03-22 Thread AVI GROSS via Python-list
Loris wrote: "Yes, I was mistakenly thinking that the popping the element would leave me with the dict minus the popped key-value pair. Seem like there is no such function." Others have tried to explain and pointed out you can del and then use the changed dict. But consider the odd concept of w

RE: Popping key causes dict derived from object to revert to object

2024-03-25 Thread AVI GROSS via Python-list
I am glad, Lori, you found a solution another way. Actually, Lori, I think you were right in looking for a built-in method that complements pop() by returning everything else other than the item mentioned. There are philosophical and practical considerations that were no doubt considered and a

RE: Popping key causes dict derived from object to revert to object

2024-03-25 Thread AVI GROSS via Python-list
Lori, The list comprehension you are thinking of does work if you change things a bit. But it is not a great idea as a main purpose of a dict is that using a hash means things are found in linear time. A comprehension iterates on all values. If you wanted to select just some items to keep in a li

RE: Can you help me with this memoization simple example?

2024-03-31 Thread AVI GROSS via Python-list
I am not sure if it was made clear that there is a general rule in python for what is HASHABLE and lists are changeable while tuples are not so the latter can be hashed as a simple copy of a list, albeit the contents must also be immutable. The memorize function uses a dictionary to store thing

Re: Multiplication

2024-04-01 Thread Avi Gross via Python-list
Is this a April 1 post for fools. Multiplication with an asterisk symbol is built into python. The same symbol used in other contexts has other contexts has an assortment of largely unrelated meanings such as meaning everything when used to import. On Mon, Apr 1, 2024, 1:27 PM Piergiorgio Sarto

RE: A technique from a chatbot

2024-04-02 Thread AVI GROSS via Python-list
I am a tad confused by a suggestion that any kind of GOTO variant is bad. The suggestion runs counter to the reality that underneath it all, compiled programs are chock full of GOTO variants even for simple things like IF-ELSE. Consider the code here: >> def first_word_beginning_with_e( list_ )

RE: A missing iterator on itertools module?

2024-04-03 Thread AVI GROSS via Python-list
Antoon, Even if the suggested solution offers a partial result, you would need specific requirements to determine what should be done if one or more of the parts being cycled is shorter than the others. Stopping at that point is one option. Another is to continue but only interleave ones still pro

RE: A technique from a chatbot

2024-04-03 Thread AVI GROSS via Python-list
technique from a chatbot On 4/3/2024 1:27 AM, AVI GROSS via Python-list wrote: > I am a tad confused by a suggestion that any kind of GOTO variant is bad. The suggestion runs counter to the reality that underneath it all, compiled programs are chock full of GOTO variants even for simple things like

RE: A technique from a chatbot

2024-04-04 Thread AVI GROSS via Python-list
That is an excellent point, Mark. Some of the proposed variants to the requested problem, including mine, do indeed find all instances only to return the first. This can use additional time and space but when done, some of the overhead is also gone. What I mean is that a generator you create and

RE: Terminal Emulator

2024-05-14 Thread AVI GROSS via Python-list
The topic was to re-invent the wheel yet again and create a terminal emulator. I hesitate to say this but one approach is to consider the curses module as described by our very own Alan Gauld in a book: https://www.amazon.com/Programming-curses-Python-Alan-Gauld-ebook/dp/B091B85 B77 The topic is

RE: From JoyceUlysses.txt -- words occurring exactly once

2024-06-04 Thread AVI GROSS via Python-list
>> Well.when using the file linux.words as a useful master list of >> "words".linux.words is strict ASCII The meaning of "words" depends on the context. The contents of the file mentioned are a minor attempt to capture a common subset of words in English but probably are not what y

RE: From JoyceUlysses.txt -- words occurring exactly once

2024-06-08 Thread AVI GROSS via Python-list
Agreed, Thomas. As someone who has spent lots of time writing code OR requirements of various levels or having to deal with the bugs afterwards, there can be a huge disconnect between the people trying to decide what to do and the people having to do it. It is not necessarily easy to come back

RE: From JoyceUlysses.txt -- words occurring exactly once

2024-06-08 Thread AVI GROSS via Python-list
I agree with Larry that the OP was asking something that might be fair to use in an interview process where perhaps an exact answer is not as important as showing how the person thinks about a process. The original question can be incomplete or vague. Do they give up? Do they ask careful questio

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-09 Thread AVI GROSS via Python-list
HH, Before bothering, it might be helpful if you spelled out a bit more in the way of requirements that would satisfy you and perhaps show your attempts. Your examples suggest it would be fairly simple to create an iterator, for example, that would yield as it examined one item at a time until it

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-09 Thread AVI GROSS via Python-list
I remembered that HenHanna had been hard to deal with in the past and when my reply to him/her/them bounced as a bad/fake address it came back to me that I am better off not participating in this latest attempt to get us to perform then probably shoot whatever we say down. A considerate person wou

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-10 Thread AVI GROSS via Python-list
> i was just curiuos about simple, clever way to write it in Python It depends on what you mean by "clever". For some, it was like a suggestion on using something already available such as itertools.groupby, perhaps even better if it is actually compiled in from a language like C and perhaps more

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-11 Thread AVI GROSS via Python-list
Rob, That is a fairly straightforward and elegant solution if using an added mode called itertools. I went a different way by creating my own focused iterator and calling it, when needed, to produce one or the other of the results requested in the functions named chunk() and chunkc(). But note

RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
I am sure there is inertia to move from an older product and some people need a reason like this where the old becomes untenable. It seems Microsoft is having a problem where something lik 2/3 of Windows users have not upgraded from Windows 10 after many years and have set a deadline in a year or

RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
lf Of MRAB via Python-list Sent: Wednesday, June 12, 2024 12:56 PM To: python-list@python.org Subject: Re: Couldn't install numpy on Python 2.7 On 2024-06-12 17:31, AVI GROSS via Python-list wrote: > I am sure there is inertia to move from an older product and some people > need a reason

RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
: Couldn't install numpy on Python 2.7 On Thu, 13 Jun 2024 at 03:41, AVI GROSS via Python-list wrote: > > Change is hard even when it may be necessary. > > The argument often is about whether some things are necessary or not. > > Python made a decision but clearly not a unanim

RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
Chris, I don't want to get off message and debate whether my "jokes" are jokes, let alone funny. Obviously, they often aren't. What I meant by joking here does seem relevant. As the years pass, there can come a time when it is suggested that a language (any language including python) is no longer

RE: Couldn't install numpy on Python 2.7

2024-06-12 Thread AVI GROSS via Python-list
Chris, You seem to have perceived an insult that I remain unaware of. I have no special knowledge, like you do, of plans made for changes to the pthon language and implementation. I was asking a hypothetical question about what some users would do if python came out with a newer major version. I

Anonymous email users

2024-06-14 Thread AVI GROSS via Python-list
I notice that in some recent discussions, we have users who cannot be replied to directly as their email addresses are not valid ones, and I believe on purpose. Examples in the thread I was going to reply to are: henha...@devnull.tb

RE: Anonymous email users

2024-06-17 Thread AVI GROSS via Python-list
Thanks, Marco, for explaining. I, personally, have no interest in finding out who people are in this case. I simply am thinking that people who do not allow me to easily reply to them directly, should be ignored by me and not get my cooperation that way. I do understand reasons people use fake ID

RE: Anonymous email users

2024-06-17 Thread AVI GROSS via Python-list
It seems clear we have people on mailing lists that see it as a purely public forum, and that is fine for them. I have found plenty of times I choose not to continue in public and waste time for people as in this reply on a topic I raised and now will move away from. I have in the past, for exa

RE: [Tutor] How to go about a simple object grabbing in python (given coordinates of arms and objects)

2024-06-24 Thread AVI GROSS via Python-list
Marc, Several people have supplied feedback on whether your request is a good fit for here. Ultimately it is up to the owner/moderator. In particular, your request to the Tutor List may not fit the purpose and be a bit complex and to the main Python List also outside some common usage whether

<    1   2   3   4   5   >