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
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
: 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
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
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_
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
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
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
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
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
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
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
(and for that matter available.) I would not want to
program the DES encryption/decryption method in Pascal again! And these days,
it seems much better to just find a module or package that meets such needs.
Avi
-Original Message-
From: Python-list On
Behalf Of dn via Python-list
Sent: Saturday
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
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
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
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
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
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
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
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
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
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
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
will be the one where a method is
finally called using some diamond algorithm. It is both extremely powerful
but also silly to overuse such features.
Avi
-Original Message-
From: Python-list On
Behalf Of Chris Angelico via Python-list
Sent: Sunday, January 14, 2024 8:34 AM
To: 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
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
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
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
ble.
Have to head out as this is already long enough.
-Original Message-
From: 'DL Neil'
Sent: Monday, November 27, 2023 2:49 AM
To: avi.e.gr...@gmail.com; python-list@python.org
Subject: Re: Newline (NuBe Question)
Avi,
On 11/27/2023 4:15 PM, avi.e.gr...@gmail.com wrote:
> Da
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
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,
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.
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
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
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,
’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
&
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
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
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
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
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.
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
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
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
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
can follow what it is doing, presents special
challenges.
Now if he ever wants to read in a .CSV file and analyze the data and make
graphs and so on, I might chime in. For now, I am dropping out.
Avi
-Original Message-
From: Python-list On
Behalf Of Thomas Passin via Python-list
Sent
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
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
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
, 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
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
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
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
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
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
There is no guarantee that argv is consulted earlier in the program than
other modules will use it for communication.
Consider a case where a program does look at argv but later wants to call
another program using some or all of the components of argv and now there
are added components there.
Interesting idea, Anton.
I would be interested in hearing more detail on how it would work.
Although much of programming has been centered on the Latin alphabet and
especially English, that may change. I can imagine a customized compiler or
interpreter that uses key words in the local language
:
> >
> >> Op 9/10/2022 om 17:49 schreef Avi Gross:
> >>> My guess is that finding 100 errors might turn out to be misleading.
> If you
> >>> fix just the first, many others would go away.
> >> At this moment I would prefer a tool that reported 100 er
in the pipeline.
When done, remove the lines with such entries or change the function
definition or something like that.
Objects used as pipelines do not do this as easily as you may need to add
methods ...
On Sun, Oct 9, 2022, 1:17 PM Peter J. Holzer wrote:
> On 2022-10-09 12:34:22 -0400, Avi Gr
:
>
>
> Op 9/10/2022 om 17:49 schreef Avi Gross:
> > My guess is that finding 100 errors might turn out to be misleading. If
> you
> > fix just the first, many others would go away.
>
> At this moment I would prefer a tool that reported 100 errors, which would
> allow me
and
parsing it. The loss in readability and so on probably is worse.
On Sun, Oct 9, 2022, 12:53 PM Chris Angelico wrote:
> On Mon, 10 Oct 2022 at 03:46, Avi Gross wrote:
> >
> > Chris, I was not arguing that at all.
>
> Maybe not intentionally, but you did lend a lot of we
heads to puzzle
things out is harder than ordering longer items ...
On Sun, Oct 9, 2022, 12:30 PM Chris Angelico wrote:
> On Mon, 10 Oct 2022 at 03:22, Avi Gross wrote:
> >
> > Smallest code blocks first may be a more modern invention.
> >
> > Some would argue for a
Since many languages allow placing multiple statements on one line or
spreading one over many lines, it seems that the number of lines in code
can be adjusted.
If I have a line like:
Alpha, beta, gamma, delta = 1, 2, 3, 4
Could that be rewritten as 4 or more lines?
I have seen programmers who
Smallest code blocks first may be a more modern invention.
Some would argue for a rule related to efficiency of execution. When you
have multiple blocks as in an if-else or case statement with multiple
choices, that you order the most common cases first. Those shorten
execution more often than
Anton
There likely are such programs out there but are there universal agreements
on how to figure out when a new safe zone of code starts where error
testing can begin?
For example a file full of function definitions might find an error in
function 1 and try to find the end of that function and
Dumb question. Your y is purely a function of x. So create an f(x) where
you want your y. It probably can even be anonymous inline. I mean your
return values of (x, y) would be (x, f(x)) ...
On Thu, Sep 1, 2022, 5:04 PM Chris Angelico wrote:
> On Fri, 2 Sept 2022 at 06:55, James Tsai wrote:
>
:
a=labels.to_dict()
If the labels variable had a method like that, that is also a way.
So be specific about what LINE or region of code and what is wrong and what you
already tried or error messages you got.
Avi
-Original Message-
From: נתי שטרן
To: Neuroimaging analysis in Python ;
python
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
varied! LOL!
-Original Message-
From: David J W
To: Avi Gross
Cc: python-list@python.org
Sent: Fri, Jun 24, 2022 11:57 am
Subject: Re: "CPython"
The main motivation for a Python virtual machine in Rust is to strengthen my
knowledge with Rust which currently has some g
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
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.
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
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
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
ck Name”
Side A, Track 1, etc.
Cheers
Dave
> On 8 Jun 2022, at 19:36, Dennis Lee Bieber wrote:
>
> On Wed, 8 Jun 2022 01:53:26 + (UTC), Avi Gross
> declaimed the following:
>
>
>>
>> So is it necessary to insist on an exact pattern of two digits followed by
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
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
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
ering name like __init__
...
-Original Message-
From: dn
To: python-list@python.org
Sent: Sat, May 14, 2022 12:33 am
Subject: Re: .0 in name
This is not what @Avi menat by "silly variable names" but:
3D_position
2nd_floor_area
3M_PostIt_size
3rd_degree_polynom
❽
-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
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
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
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
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
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
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
. Was it their
choice or required for a course or job or ...
Sometimes the answer is to use something else they already know, albeit Python
is a very decent language for many uses and well-worth learning even if you
know others.
-Original Message-
From: Chris Angelico
To: Avi Gross
Cc
@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
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
t;, "Return(s)": "Text",
"Optional-Note": "Text", "French version": DocStringFrench}
Too late to seriously change the language now!
-Original Message-
From: Michael F. Stemper
To: python-list@python.org
Sent: Sun, Apr 24, 2022 9:24 am
Subj
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,
.
-Original Message-
From: Michael F. Stemper
To: python-list@python.org
Sent: Sat, Apr 23, 2022 8:57 am
Subject: Re: Style for docstring
On 22/04/2022 21.58, Avi Gross wrote:
> Python does have a concept of "truthy" that includes meaning for not just the
> s
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
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
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
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
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
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
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
1 - 100 of 403 matches
Mail list logo