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

RE: A technique from a chatbot

2024-04-03 Thread AVI GROSS via Python-list
: A 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 l

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

RE: Newline (NuBe Question)

2023-11-27 Thread AVI GROSS via Python-list
Dave, I gave an example, again, and make no deep claims so your comments may be valid, without any argument. I mentioned CSV and a related family such as TSV as they were a common and simple data format that has long been used. There are oodles of others and yes, these days many people can

RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
Dave, Back on a hopefully more serious note, I want to make a bit of an analogy with what happens when you save data in a format like a .CSV file. Often you have a choice of including a header line giving names to the resulting columns, or not. If you read in the data to some structure, often

RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
Isn't it fascinating that a meaningless piece of code used to illustrate something can be analyzed as if it was full of malicious content? Yes, my choice of names was as expected. The numbers chosen had no special meaning other than choosing one number in each of three equivalence classes. But,

RE: RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
Just FYI, I deliberately chose that abbreviation for a sort of irony as for some people college is about almost anything except learning and some people think they are studs and just party and ... And I am very tired of gender discussions. Lots of words now include two or even more genders.

RE: RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
That is an entirely different discussion, Michael. I do not know what ideas Guido had ages ago and where he might stand now and I actually seriously disagree with the snippet you quoted below. Python was started long ago as a way to improve in some ways on what was there before. Some of the

RE: Newline (NuBe Question)

2023-11-24 Thread AVI GROSS via Python-list
Grizz[l]y, I think the point is not about a sorted list or sorting in general It is about reasons why maintaining a data structure such as a list in a program can be useful beyond printing things once. There are many possible examples such as having a list of lists containing a record where the

RE: Code improvement question

2023-11-17 Thread AVI GROSS via Python-list
Many features like regular expressions can be mini languages that are designed to be very powerful while also a tad cryptic to anyone not familiar. But consider an alternative in some languages that may use some complex set of nested function calls that each have names like match_white_space(2,

RE: xor operator (DEPRECATED)

2023-11-13 Thread AVI GROSS via Python-list
’t require predicates. b) I welcome any thoughts on this. DG > On 14 Nov 2023, at 04:27, AVI GROSS via Python-list > wrote: > > I was going to ask a dumb question. Has any other language you know of made > something available that does what is being asked for and included it in the &

RE: xor operator

2023-11-13 Thread AVI GROSS via Python-list
I was going to ask a dumb question. Has any other language you know of made something available that does what is being asked for and included it in the main program environment rather than an add-on? A secondary mention here has been whether short-circuiting functions like "any" and "all" have

RE: Checking if email is valid

2023-11-07 Thread AVI GROSS via Python-list
Text messages have taken a nasty turn and especially now that so many people have unlimited messages per month in their plan. People overuse them to the point where I opt out of some things like my home town notifications as they bombard me with other things I am not interested in. A major

RE: Python Golf

2023-11-07 Thread AVI GROSS via Python-list
Discussions like this feel a bit silly after a while. How long something is to type on a command line is not a major issue and brevity can lead to being hard to remember too especially using obscure references. Consider that the Perl version as shown below does not need to import anything. If

RE: Checking if email is valid

2023-11-06 Thread AVI GROSS via Python-list
Just mildly noticing the topics discussed have wandered quite a bit away from Python, let alone even programming. Phone numbers are not what they used to be. They tend to be quite portable and in some ways can be chained so my house phone rings through to my cell phone but a text will not be

RE: Checking if email is valid

2023-11-05 Thread AVI GROSS via Python-list
Grant (and others), I am asking about the overall programming process of dealing with email addresses beyond checking the string for some validity. You mentioned requiring you type in your email twice as one example. I generally do a copy/paste to avoid typing or have my browser fill it in.

RE: Checking if email is valid

2023-11-03 Thread AVI GROSS via Python-list
addresses. -Original Message- From: Python-list On Behalf Of Chris Angelico via Python-list Sent: Friday, November 3, 2023 1:43 AM To: python-list@python.org Subject: Re: Checking if email is valid On Fri, 3 Nov 2023 at 12:21, AVI GROSS via Python-list wrote: > My guess is that a first t

RE: Checking if email is valid

2023-11-02 Thread AVI GROSS via Python-list
I have never had a need to check email but in my reading over the years, I am aware of modules of multiple kinds you can use to do things like parsing dates, URL and email addresses and probably many other such things into some kind of object and then you can use aspects of the object to do

RE: Checking if email is valid

2023-11-02 Thread AVI GROSS via Python-list
via Python-list Sent: Thursday, November 2, 2023 2:05 AM To: python-list@python.org Subject: Re: Checking if email is valid On Thu, 2 Nov 2023 at 15:20, AVI GROSS via Python-list wrote: > > Yes, it would be nice if there was a syntax for sending a test message sort > of li

RE: Checking if email is valid

2023-11-01 Thread AVI GROSS via Python-list
Yes, it would be nice if there was a syntax for sending a test message sort of like an ACK that is not delivered to the recipient but merely results in some status being sent back such as DELIVERABLE or NO SUCH USER or even MAILBOX FULL. An issue with the discussion that may be worth considering

RE: Question(s)

2023-10-26 Thread AVI GROSS via Python-list
: Thursday, October 26, 2023 6:50 PM To: python-list@python.org Subject: Re: Question(s) On 10/26/2023 6:36 PM, AVI GROSS via Python-list wrote: > I am not one for IDLE worship, Tenor. But if you have been getting a message here, it is that there are an amazing number of programs that support your

RE: Question(s)

2023-10-26 Thread AVI GROSS via Python-list
I am not one for IDLE worship, Tenor. But if you have been getting a message here, it is that there are an amazing number of programs that support your use of python during the development phase and perhaps later. I actually often use an environment called RSTUDIO (now part of a new name of

RE: Question(s)

2023-10-25 Thread AVI GROSS via Python-list
Just want to add that even when you can prove that an algorithm works absolutely positively, it will often fail on our every finite computers. Consider families of algorithms that do hill climbing to find a minimum and maximum and are guaranteed to get ever closer to a solution given infinite

RE: Question(s)

2023-10-25 Thread AVI GROSS via Python-list
ubject: Re: Question(s) On Tue, Oct 24, 2023 at 9:36 PM AVI GROSS via Python-list wrote: > > Agreed, Chris. There are many methods way better than the sort of RAID > architecture I supplied as AN EXAMPLE easy to understand. But even so, if a > hard disk or memory chip is fried or a nuclear bomb

RE: Question(s)

2023-10-24 Thread AVI GROSS via Python-list
, 2023 9:41 PM To: python-list@python.org Subject: Re: Question(s) On Wed, 25 Oct 2023 at 12:20, AVI GROSS via Python-list wrote: > Consider an example of bit rot. I mean what if your CPU or hard disk has a location where you can write a byte and read it back multiple times and sometimes get the wr

RE: Question(s)

2023-10-24 Thread AVI GROSS via Python-list
Whoa! The question cannot be about whether it is possible to prove any abstract program will be correct and especially not on real hardware that can fail in various ways or have unexpected race conditions or interacts with other places such as over the internet. It has been quite well proven

RE: Where I do ask for a new feature

2023-10-20 Thread AVI GROSS via Python-list
I still see no great reason for a new feature here and the namespace issue has often been discussed. You can always opt to create your own namespace of some sort and make many of your variables within it and always refer to the variables explicitly so the only collisions that can happen are

RE: Where I do ask for a new feature

2023-10-19 Thread AVI GROSS via Python-list
Bongo, Variables in most programming languages either have to be removed manually or allowed to drift outside a boundary when they disappear for scoping reasons and perhaps are garbage collected at some point. There are many ways to make transient variables that disappear at some time and do we

RE: Postgresql equivalent of Python's timeit?

2023-09-17 Thread AVI GROSS via Python-list
Timing things that are fairly simple is hard enough to do repeatedly, but when it involves access to slower media and especially to network connections to servers, the number of things that can change are enormous. There are all kinds of caching at various levels depending on your hardware and

RE: Fwd: AUTO EDITOR DIDN'T WORK

2023-06-13 Thread AVI GROSS via Python-list
I think it is time to ask this topic to go find some other place to talk to itself. I have seen NO reason to think any question about problems with Python has been asked. Not properly. It sounds like someone messed up an installation, perhaps of other programs like an editor and some

Re: what's the problem??????

2022-07-13 Thread Avi Gross via Python-list
Nati, This is a two-way process and requires you to be very clear on what is not working or what you are trying to do or help clear away having us try to understand lots of code that is not very related to the question. Your code, as shown, makes an empty string repeatedly in a loop.  a=dict() I

Re: NILEARN - WHY THIS CODE THROWS AN ERROR?????

2022-07-08 Thread Avi Gross via Python-list
Nati Stern has asked several questions here, often about relatively technical uses of python code that many of us have never used and still is not providing more exact info that tends to be needed before anyone can even think of diagnosing the problem. I have learned to stay away from some

Re: "CPython"

2022-06-24 Thread Avi Gross via Python-list
David, I understand now. As a project for your own edification I can understand it, albeit it is a more substantial effort than many people might choose, LOL! So unless it starts being used heavily and adopted by some organization, the result of your effort will not necessarily be compatible

Re: "CPython"

2022-06-23 Thread Avi Gross via Python-list
David, I am curious why you are undertaking the effort to take a language already  decades old and showing signs of being a tad rusty into a language that suggests further oxidation. More seriously, I am interested in what this can gain and the intended user  base. I studied Rust for a while and

Re: "CPython"

2022-06-21 Thread Avi Gross via Python-list
If we want to be humorous, RPython would obviously either be written in R, which really is not designed well for such purposes, or would be some kind of synthesis that already exists that allows you to run R and python code interchangeably on sort of shared data that I sometimes do in RSTUDIO.

Re: "CPython"

2022-06-20 Thread Avi Gross via Python-list
This leads to the extremely important question of what would an implementation of Python, written completely in C++, be called? C++Python CPython++ C+Python+ DPython SeaPython? SeeSeaSiPython I don't even want to think fo what sound a C# Python would make. OK, my apologies to all. Being an

Re: fill out bulletins

2022-06-14 Thread Avi Gross via Python-list
I wish this discussion was simplified. It sounds to me like what is wanted is a way to PRINT a filled-out form using some dynamic text that fits over designated slots in the data. It is not that different from many other tasks where you overlay some graphics with text. You need a decent version

Re: Function to Print a nicely formatted Dictionary or List?

2022-06-09 Thread Avi Gross via Python-list
Dave, Despite your other programming knowledge, I suspect you think this is the forum where people come to be tutored. Try here: https://mail.python.org/mailman/listinfo/tutor Yes, there are plenty of pretty printers available and you can build your own function fairly easily. A module like

Re: How to test characters of a string

2022-06-09 Thread Avi Gross via Python-list
Dave, Sometimes a task is done faster by NOT programming anything in any language! Not only have you spent a lot of your own time but many dozens of messages here have dragged in others, who gain nothing ;-) The domain you are operating in seems to have lots of variants in how the titles are

Re: How to replace characters in a string?

2022-06-08 Thread Avi Gross via Python-list
Dave, Your goal is to compare titles and there can be endless replacements needed if you allow the text to contain anything but ASCII. Have you considered stripping out things instead? I mean remove lots of stuff that is not ASCII in the first place and perhaps also remove lots of extra

Re: How to test characters of a string

2022-06-07 Thread Avi Gross via Python-list
Amazing how some people bring out the heavy artillery, first! LOL! If the question was how to remove any initial digits and perhaps whitespace in a string, it is fairly easy to do without any functions to test if there are digits before the title. I mean look at initial characters and move

Re: oop issue

2022-05-23 Thread Avi Gross via Python-list
invest_crypto.client_list.append(self) I am wondering about the phrasing above. When you are in the dunder init function, you normally create and change items in YOURSELF so why is your code not changing self.crypto_client_list? And what are you appending to before ever creating it? Would it

Re: .0 in name

2022-05-13 Thread Avi Gross via Python-list
You left out 3CPO, Dave. Names with numerals are not unreasonable in some circumstances. But programming languages are not a full spectrum of real life. They can have  reserved words too so you may not be able to use "while" and if you choose to create a function that masks another, you cannot

Re: .0 in name

2022-05-13 Thread Avi Gross via Python-list
 ❽ -Original Message----- From: Avi Gross via Python-list To: python-list@python.org Sent: Fri, May 13, 2022 6:02 pm Subject: Re: .0 in name Bryan, As has been pointed out, it is very common in possibly all programming languages to not allow digits at the start of many identifiers. It make

Re: .0 in name

2022-05-13 Thread Avi Gross via Python-list
Bryan, As has been pointed out, it is very common in possibly all programming languages to not allow digits at the start of many identifiers. It makes it hard to parse for numbers which tend to start with digits. Some languages even have special rules on not starting a number with a zero unless

Re: tail

2022-05-11 Thread Avi Gross via Python-list
This seems to be a regular refrain where someone wants something as STANDARD in a programming language or environment and others want to keep it lean and mean or do not see THIS suggestion as particularly important or useful. Looking at the end of something is extremely common. Packages like

Re: tail

2022-05-11 Thread Avi Gross via Python-list
Just FYI, UNIX had a bunch of utilities that could emulate a vanilla version of tail on a command line. You can use sed, awk and quite a few others to simply show line N to the end of a file or other variations.  Of course the way many things were done back then had less focus on efficiency

Re: tail

2022-05-07 Thread Avi Gross via Python-list
Marco, I think it was made clear from the start that "text" files in the classic sense have no random access method at any higher level than reading a byte at some offset from the beginning of the file, or back from the end when it has not grown. The obvious fact is that most of the time the

Re: Python/New/Learn

2022-05-06 Thread Avi Gross via Python-list
This topic has rapidly shifted over way beyond Python even as the original  person has not returned to participate. There are many ways to teach anything and since the classical method was to learn in person from someone using mainly sound or pantomime, it has hung on. Even with the existence

Re: Python/New/Learn

2022-05-05 Thread Avi Gross via Python-list
Before more people reply to this user, I note I have not seen them reply back to the list about any questions or comments others have taken the time to provide. My warning bells go off when I see patterns and there was a similar request from another gmail account to an R language forum I am

Re: Python/New/Learn

2022-05-04 Thread Avi Gross via Python-list
I agree Chris that the Ukrainian Python Books are daunting as I barely started learning that language now even though my early years were just a few miles away and I might even have relatives still there! But as has been pointed out, suggestions are more helpful if you know a bit more about

Re: Python/New/Learn

2022-05-04 Thread Avi Gross via Python-list
@python.org Sent: Wed, May 4, 2022 11:02 pm Subject: Re: Python/New/Learn On Thu, 5 May 2022 at 12:57, Avi Gross via Python-list wrote: > > https://wiki.python.org/moin/PythonBooks > That's an incredibly daunting list, and not something I'd overly strongly recommend, but yes, if you want to g

Re: Python/New/Learn

2022-05-04 Thread Avi Gross via Python-list
https://wiki.python.org/moin/PythonBooks -Original Message- From: Patrick 0511 To: python-list@python.org Sent: Wed, May 4, 2022 9:36 pm Subject: Python/New/Learn Hello, I'm completely new here and don't know anything about python. Can someone tell me how best to start? So what things

Re: Style for docstring

2022-04-24 Thread Avi Gross via Python-list
Yes, Michael, a dictionary is an excellent way to represent a closed set of transitions which your permutations are. You examples use numerals but obviously a dictionary will allow transformations  of anything that can be hashed which mostly is items that are not mutable. Of course for the

Re: tail

2022-04-24 Thread Avi Gross via Python-list
I have been getting confused by how many interpretations and conditions for chasing tail people seem to be talking about. A fairly normal task is to want to see just the last N lines of a text-based  file.  A variant is the "tail -f" command from UNIX that continues to follow a growing file,

Re: Style for docstring

2022-04-23 Thread Avi Gross via Python-list
Given what you added, Michael, your function is part of a larger collection of functions and being compatible with the others is a valid consideration. Whatever you decide, would ideally be done consistently with all or most of them. And, of course, it others in the collection also can handle 

Re: Style for docstring

2022-04-22 Thread Avi Gross via Python-list
We know some people using "professional" language make things shorteror talk from a point of view different than others and often in otherwise  incomprehensible jargon. If a programmer is taking about the algorithm that a function implements, then, yes, they may write "scan" and "return". But

Re: Style for docstring

2022-04-22 Thread Avi Gross via Python-list
Python does have a concept of "truthy" that includes meaning for not just the standard Booleans but for 0 and non-zero and the empty string and many more odd things such as an object that defines __bool__ (). But saying it returns a Boolean True/False valuesounds direct and simple and

Re: Why no list as dict key?

2022-04-20 Thread Avi Gross via Python-list
This does raise an issue, Chris, if you use the method of making a tuple  companion for a list at a specific time just for use as a dictionary key, then later change the list, you can end up with various situations. Obviously the changed list can not only not access the stored item, but if

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

Re: dict.get_deep()

2022-04-04 Thread Avi Gross via Python-list
ample 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 in this subject sounded to ME likethey had nest

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

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

Re: for convenience

2022-03-24 Thread Avi Gross via Python-list
Yes, Chris, you can do all kinds of useful things in Python and I can not make much of a case for requiring a pre-processor. The main reason would be to make code that interprets faster or produces a smaller file of Python commands. All I was saying was that there might be a scenario where a

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
ris 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, sometimes well and sometimes

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

Re: convenience

2022-03-22 Thread Avi Gross via Python-list
Greg, Yes, what I describe may not be common and some code goes to serious lengths precisely to make direct connections to internals on an object hard to access. But Python indeed allows and perhaps encourages you to use what you consider side effects but perhaps more. There are many dunder

Re: for convenience

2022-03-22 Thread Avi Gross via Python-list
I sent George a private reply as discussing other languages gets rapidly off-topic. I want to add a small addendum here about the technique he used and a Dave Neal and others are trying, a way to imagine things that is more compatible with how a language like Python works so it meets

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: 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,

Re: Behavior of the for-else construct

2022-03-06 Thread Avi Gross via Python-list
e 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 other than I d

Re: Behavior of the for-else construct

2022-03-05 Thread Avi Gross via Python-list
I am not clear on what you are commenting, Dennis. You are responding to what I do not believe I wrote. You did not quote the part of my message where I wrote what "I" did in the early 80's and did not say when PASCAL was available elsewhere. "I paid no attention to where PASCAL was being used

Re: Behavior of the for-else construct

2022-03-05 Thread Avi Gross via Python-list
-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 >> a

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: ... ) :

  1   2   3   >