On 2024-09-30, Dan Sommers via Python-list wrote:
> In Common Lisp, integers can be written in any integer base from two
> to thirty six, inclusive. So knowing the last digit doesn't tell
> you whether an integer is even or odd until you know the base
> anyway.
I had to think about that for an
On 2024-09-30, Dan Sommers via Python-list wrote:
> On 2024-09-30 at 11:44:50 -0400,
> Grant Edwards via Python-list wrote:
>
>> On 2024-09-30, Left Right via Python-list wrote:
>> > [...]
>> > Imagine a pathological case of this shape: 1... <60GB of digits&g
On 2024-09-30, Left Right via Python-list wrote:
> Whether and to what degree you can stream JSON depends on JSON
> structure. In general, however, JSON cannot be streamed (but commonly
> it can be).
>
> Imagine a pathological case of this shape: 1... <60GB of digits>. This
> is still a valid JSON
On 2024-08-27, Gilmeh Serda via Python-list wrote:
> On 25 Aug 2024 15:46:25 GMT, Stefan Ram wrote:
>
>> f"{int(number):>20,}"
>
> Great. Thanks. Do you have a link to where that's documented?
>
> I did web search, found nothing.
https://docs.python.org/3/library/string.html#formatspec
https://do
On 2024-08-05, aotto1968 via Python-list wrote:
> Is it possible to run two completely independent Python interpreters
> in one process, each using a thread?
>
> By independent, I mean that no data is shared between the
> interpreters and thus the C API can be used without any other
> "lock/GIL"
On 2024-07-31, marc nicole via Python-list wrote:
> I suppose the meaning of those numbers comes from this line
> predicts_dict[class_name].append([int(xmin), int(ymin), int(xmax),
> int(ymax), P[index]]) as well as the yolo inference call. But i was
> expecting zeros for all classes except small
On 2024-06-24, Barry Scott via Python-list wrote:
>> On 23 Jun 2024, at 06:58, Sebastian Wells via Python-list
>> wrote:
>>
>> The spammers won the spam wars, so even if you have someone's real
>> e-mail address, that's no guarantee that you can contact them. [...]
>
> My email address is well
On 2024-06-18, Mats Wichmann via Python-list wrote:
> On 6/17/24 17:51, dn via Python-list wrote:
>
>> +1
>>
>> The "public" part is not to embarrass posters, but recognition that
>> there are likely other people 'out there' (or arriving in-future if they
>> care to read the archives) experienc
On 2024-06-17, Roel Schroeven via Python-list wrote:
> FWIW, personally I (mostly) don't see the point of replying to people
> personally. To me a public mailing list is much like any public forum,
> where my expectation is that conversations happen in public. To me it
> always feels weird whe
On 2024-06-08, Larry Martell via Python-list wrote:
> The original question struck me as homework or an interview question for a
> junior position. But having no clear requirements or specifications is good
> training for the real world where that is often the case. When you question
> that, you
On 2024-06-05, dn via Python-list wrote:
> If you/your teacher can't define a "word", the code, any code, will
> almost-certainly be wrong!
Back when I was a student...
When there was a homework/project assignemnt with a vague requirement
(and it wasn't practical to get the requirement refined
On 2024-06-04, Edward Teach via Python-list wrote:
> On Mon, 03 Jun 2024 14:58:26 -0400 (EDT)
> Grant Edwards wrote:
>
>> On 2024-06-03, Edward Teach via Python-list
>> wrote:
>>
>> > The Gutenburg Project publishes "plain text". That's another
>> > problem, because "plain text" means UTF-8...
On 2024-06-03, Edward Teach via Python-list wrote:
> The Gutenburg Project publishes "plain text". That's another
> problem, because "plain text" means UTF-8and that means
> unicode...and that means running some sort of unicode-to-ascii
> conversion in order to get something like "words". A
On 2024-05-31, Pieter van Oostrum via Python-list
wrote:
> HenHanna writes:
>
>> Given a text file of a novel (JoyceUlysses.txt) ...
>>
>> could someone give me a pretty fast (and simple) Python program that'd
>> give me a list of all words occurring exactly once?
>>
>> -- Also, a
On 2024-05-29, Mats Wichmann via Python-list wrote:
> On 5/29/24 08:02, Grant Edwards via Python-list wrote:
>> On 2024-05-29, Chris Angelico via Python-list wrote:
>>
>>> print(f"if block {name[index]=} {index=}")
>>
>> Holy cow! How did I not kn
On 2024-05-29, Chris Angelico via Python-list wrote:
> print(f"if block {name[index]=} {index=}")
Holy cow! How did I not know about the f-string {=} thing?
--
Grant
--
https://mail.python.org/mailman/listinfo/python-list
On 2024-05-26, Gilmeh Serda via Python-list wrote:
> The web claims (I think on all pages I've read about Markdown and Python)
> that this code should work, with some very minor variants on the topic:
>
> ```python
>
> import os
>
> with open(os.path.join('/home/user/apath', 'somefile')) as f:
>
On 2024-05-19, Barry via Python-list wrote:
>
>
>> On 18 May 2024, at 16:27, Peter J. Holzer via Python-list
>> wrote:
>>
>> I don't think Linux users have to deal with venvs
>
> Modern debian (ubuntu) and fedora block users installing using pip.
You can't even use pip to do "user" installs?
On 2024-05-19, Gilmeh Serda via Python-list wrote:
> On Sun, 19 May 2024 08:32:46 +0100, Alan Gauld wrote:
>
>> I've honestly never experienced this "nightmare".
>> I install stuff and it just works.
>
> Hear! Hear! Me too! And all that.
>
> I'm on Manjaro, which is a tad finicky about other peopl
On 2024-05-19, Alan Gauld via Python-list wrote:
>> The dependency nightmare created by python, pip
>> and all the rest cannot be resolved otherwise.
>
> I've honestly never experienced this "nightmare".
> I install stuff and it just works.
Same here. I occasonlly use pip to install something t
On 2024-05-18, Mats Wichmann via Python-list wrote:
> Distros have do offer a good selection of packaged Python bits, yes, but
> only for the version of Python that's "native" to that distro release.
> If you need to test other versions of Python, you're mostly on your own.
For a few years I n
On 2024-05-18, Peter J. Holzer via Python-list wrote:
> On 2024-05-16 19:46:07 +0100, Gordinator via Python-list wrote:
>
>> To be fair, the problem is the fact that they use Windows (but I
>> guess Linux users have to deal with venvs, so we're even.
>
> I don't think Linux users have to deal with
On 2024-05-14, Alan Gauld via Python-list wrote:
> On 14/05/2024 18:44, Gordinator via Python-list wrote:
>
>> I wish to write a terminal emulator in Python. I am a fairly
>> competent Python user, and I wish to try a new project idea. What
>> references can I use when writing my terminal emulator
On 2024-05-14, Alan Gauld via Python-list wrote:
> On 14/05/2024 18:44, Gordinator via Python-list wrote:
>
>> I wish to write a terminal emulator in Python. I am a fairly
>> competent Python user, and I wish to try a new project idea. What
>> references can I use when writing my terminal emulator
On 2024-04-10, Alan Gauld via Python-list wrote:
> On 10/04/2024 19:50, WordWeaver Evangelist via Python-list wrote:
>
>> I have a simple question. I use the following textPrompt in some of my
>> Jython modules:
>> '\n[1;33mYour choice is? (A B C D E): ', maxChars=1, autoAccept=False,
>> force
On 2024-04-10, WordWeaver Evangelist via Python-list
wrote:
> I have a simple question. I use the following textPrompt in some of my Jython
> modules:
> '\n[1;33mYour choice is? (A B C D E): ', maxChars=1, autoAccept=False,
> forceUppercase=True)
> Is there a way to add an ANSI color code t
On 2024-03-25, Loris Bennett via Python-list wrote:
> Grant Edwards writes:
>
>> On 2024-03-22, Loris Bennett via Python-list wrote:
>>
>>> Yes, I was mistakenly thinking that the popping the element would
>>> leave me with the dict minus the popped key-value pair.
>>
>> It does.
>
> Indeed, but
On 2024-03-22, Loris Bennett via Python-list wrote:
> Yes, I was mistakenly thinking that the popping the element would
> leave me with the dict minus the popped key-value pair.
It does.
> Seem like there is no such function.
Yes, there is. You can do that with either pop or del:
>>> d =
On 2024-03-21, MRAB via Python-list wrote:
> As it's recommended to use the Python Launcher py on Windows, I use
> that instead:
>
> py -m pip install something
>
> because it gives better support if you have multiple versions of
> Python installed.
I adopted that practice years ago on Linux as
On 2024-03-15, Thomas Passin via Python-list wrote:
> On 3/15/2024 5:30 AM, Loris Bennett via Python-list wrote:
>> Hi,
>>
>> I am initialising an object via the following:
>>
>> def __init__(self, config):
>>
>> self.connection = None
>>
>> self.source_name = config['so
On 2024-03-08, Thomas Passin via Python-list wrote:
>
>> Hi, I tested this with Python 3.8. Good to know that this was fixed!
>
> We just learned a few posts back that it might be specific to Linux; I
> ran it on Windows.
On Linux, the limit is imposed by the filesystem. Most of the "real"
file
On 2024-03-08, Grant Edwards via Python-list wrote:
>> OSError: [Errno 36] File name to
On 2024-03-08, Grant Edwards via Python-list wrote:
> On 2024-03-08, Thomas Passin via Python-list wrote:
>> On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote:
>>> Hi,
>>> I was replacing some os.path stuff with Pathlib and I discovered this:
>
On 2024-03-08, Thomas Passin via Python-list wrote:
> On 3/8/2024 1:03 PM, Albert-Jan Roskam via Python-list wrote:
>> Hi,
>> I was replacing some os.path stuff with Pathlib and I discovered this:
>> Path(256 * "x").is_file() # OSError
>> os.path.isfile(256 * "x") # bool
>> I
On 2024-03-08, Chris Angelico via Python-list wrote:
> On Sat, 9 Mar 2024 at 00:51, Grant Edwards via Python-list
> wrote:
>
>> One might argue that "global" isn't a good choice for what to call the
>> scope in question, since it's not global. It's l
On 2024-03-07, Cameron Simpson via Python-list wrote:
> Yes. Note that the "global" namespace is the module in which the
> function is defined.
One might argue that "global" isn't a good choice for what to call the
scope in question, since it's not global. It's limited to that source
file. It d
On 2024-03-07, dn via Python-list wrote:
> The idea of importing a module into the REPL and then (repeatedly)
> manually entering the code to set-up and execute is unusual (surely type
> such into a script (once), and run that (repeatedly). As you say, most
> of us would be working from an IDE
On 2024-03-06, Roel Schroeven via Python-list wrote:
> Op 6/03/2024 om 17:40 schreef Jacob Kruger via Python-list:
>> >>> from scoping2 import *
>
> [...]
>
> I would advice not to use 'import *', if at all possible, for multiple
> reasons, one of which is to prevent problems like this.
Unfortun
On 2024-03-06, MRAB via Python-list wrote:
> On 2024-03-06 01:44, Ethan Furman via Python-list wrote:
>> On 3/5/24 16:49, MRAB via Python-list wrote:
>> > On 2024-03-06 00:24, Ethan Furman via Python-list wrote:
>> >> On 3/5/24 16:06, Chano Fucks via Python-list wrote:
>> >>
>> >>> [image:
On 2024-03-05, Cameron Simpson via Python-list wrote:
> Because there are no variable definitions in Python, when you write
> a function Python does a static analysis of it to decide which
> variables are local and which are not. If there's an assignment to a
> variable, it is a local variable.
On 2024-02-24, MRAB via Python-list wrote:
> On 2024-02-24 01:14, Steve GS via Python-list wrote:
>
>> Python, Tkinter: How do I determine if a window has been resized? I
>> want to locate buttons vertically along the right border and need
>> to know the new width. The buttons are to move with the
On 2024-02-19, Chris Green via Python-list wrote:
> It's using f'{...}' at the moment.
Here's a demonstration of how to hook custom code into the f-string
formatting engine. It's brilliantly depraved.
https://stackoverflow.com/questions/55876683/hook-into-the-builtin-python-f-string-format-mach
On 2024-02-19, Thomas Passin wrote:
>> About 24 hours later, all of my posts (and the confirmation e-mails)
>> all showed up in a burst at the same time on two different unrelated
>> e-mail accounts.
>>
>> I still have no clue what was going on...
>
> Sometimes a post of mine will not show up fo
On 2024-02-18, Peter J. Holzer via Python-list wrote:
> [Replying to the list *and* Grant]
>
> On 2024-02-17 19:38:04 -0500, Grant Edwards via Python-list wrote:
>> Today I noticed that nothing I've posted to python-list in past 3
>> weeks has shown up on the list.
>
Today I noticed that nothing I've posted to python-list in the past 3
weeks has shown up on the list. I don't know how to troubleshoot this
other than by sending test messages. Obviously, if this shows up on the
list, then I'm making progress...
[message 3]
--
Grant
--
https://mail.python.org/ma
Today I noticed that nothing I've posted to python-list in past 3
weeks has shown up on the list. I don't know how to troubleshoot this
other than sending test messages. Obviously, if this shows up on the
list, then I'm making progress.
[message 4]
--
Grant
--
https://mail.python.org/mailman/l
Today I noticed that nothing I've posted to python-list in past 3
weeks has shown up on the list. I don't know how to troubleshoot this
other than sending test messages. Obviously, if this shows up on the
list, then I've gotten it to work...
--
Grant
--
https://mail.python.org/mailman/listinfo/
Today I noticed that nothing I've posted to python-list in past 3
weeks has shown up on the list. I don't know how to troubleshoot this
other than sending test messages. Obviously, if this shows up on the
list, then I've gotten it to work...
--
Grant
--
https://mail.python.org/mailman/listinfo/
On 2024-02-16, Chris Green wrote:
> I'm looking for a simple way to make NaN values output as something
> like '-' or even just a space instead of the string 'nan'.
I tried monkey-patching the __format__ method of float, but it's
immutable, so that didnt' work. Is float.__format__ what's used b
[I've been trying all afternoon to post via slrn, but nothing is
showing up on the list. Forgive me if multiple posts eventually show
up.]
On 2024-02-17, Cameron Simpson via Python-list wrote:
> On 16Feb2024 22:12, Chris Green wrote:
>>I'm looking for a simple way to make NaN values output as s
[Posts via slrn and my GMail account aren't showing up, so I guess I'll
try
subscribing from a different e-mail address.]
On 2024-02-17, Cameron Simpson via Python-list
wrote:
On 16Feb2024 22:12, Chris Green wrote:
I'm looking for a simple way to make NaN values output as something
like '-'
On 2024-02-17, Cameron Simpson via Python-list wrote:
> On 16Feb2024 22:12, Chris Green wrote:
>>I'm looking for a simple way to make NaN values output as something
>>like '-' or even just a space instead of the string 'nan'. [...]
>>
>>Battery Voltages and Currents
>>Leisure Battery - 1
On 2024-02-17, Cameron Simpson via Python-list wrote:
> On 16Feb2024 22:12, Chris Green wrote:
>>I'm looking for a simple way to make NaN values output as something
>>like '-' or even just a space instead of the string 'nan'. [...]
>>
>>Battery Voltages and Currents
>>Leisure Battery - 1
On 2024-02-17, Cameron Simpson via Python-list wrote:
> On 16Feb2024 22:12, Chris Green wrote:
>>I'm looking for a simple way to make NaN values output as something
>>like '-' or even just a space instead of the string 'nan'. [...]
>>
>>Battery Voltages and Currents
>>Leisure Battery - 12
On 2024-02-17, Cameron Simpson via Python-list wrote:
> On 16Feb2024 22:12, Chris Green wrote:
>>I'm looking for a simple way to make NaN values output as something
>>like '-' or even just a space instead of the string 'nan'.
>>[...]
>>
>>Battery Voltages and Currents
>>Leisure Battery -
On 2024-02-16, Chris Green via Python-list wrote:
> I'm looking for a simple way to make NaN values output as something
> like '-' or even just a space instead of the string 'nan'.
It would probably help if you told us how you're "outputting" them now
(the Python feaatures/functions used, not th
On 2024-01-29, Rich Shepard via Python-list wrote:
> On Mon, 29 Jan 2024, Rich Shepard via Python-list wrote:
>
>> No, I hadn't ... but I am reading it now.
>
> Perhaps I missed the answer to my question when reading the io module. It
> explains how to open/write/read files of text and binary data
On 2023-12-28, Peter J. Holzer via Python-list wrote:
> On 2023-12-28 05:20:07 +, rbowman via Python-list wrote:
>> On Wed, 27 Dec 2023 03:53:42 -0600, Greg Walters wrote:
>> > The biggest caveat is that the shared variable MUST exist before it can
>> > be examined or used (not surprising).
>>
On 2023-12-11, Chris Green via Python-list wrote:
> Is there a way to abbreviate the following code somehow?
>
> lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'}
> sv = {'dev':'bbb', 'input':'0', 'name':'Starter volts'}
> la = {'dev':'bbb', 'input':'2', 'name':'Leisure Amps'}
>
On 2023-11-27, Grant Edwards via Python-list wrote:
> On 2023-11-26, Dieter Maurer via Python-list wrote:
>
>> If you do not have this case (e.g. usually if you open the file
>> in a class's `__init__`), you do not use a context manager.
>
> He knows that. The OP wro
On 2023-11-26, Dieter Maurer via Python-list wrote:
> If you do not have this case (e.g. usually if you open the file
> in a class's `__init__`), you do not use a context manager.
He knows that. The OP wrote that he wants to use that can
_only_ be used by a context manager, but he wants that us
On 2023-11-14, Dom Grigonis via Python-list wrote:
>
>> Except the 'any' and 'all' builtins are _exactly_ the same as bitwise
>> or and and applided to many bits. To do something "in line" with that
>> using the 'xor' operator would return True for an odd number of True
>> values and False for an
On 2023-11-13, Dom Grigonis via Python-list wrote:
> I am not asking. Just inquiring if the function that I described
> could be useful for more people.
>
> Which is: a function with API that of `all` and `any` and returns
> `True` if specified number of elements is True.
I've got no objection t
On 2023-11-13, Dom Grigonis via Python-list wrote:
> Hi All,
>
> I think it could be useful to have `xor` builtin, which has API similar to
> the one of `any` and `all`.
>
> * Also, it could have optional second argument `n=1`, which
> * indicates how many positives indicates `True` return. For
On 2023-11-06, Greg Ewing via Python-list wrote:
> On 7/11/23 7:45 am, Mats Wichmann wrote:
>> Continuing with the example, if you have a single phone number field, or
>> let a mobile number be entered in a field marked for landline, you will
>> probably assume you can text to that number.
>
> B
On 2023-11-05, D'Arcy Cain via Python-list wrote:
> On 2023-11-05 00:39, Grant Edwards via Python-list wrote:
>> Definitely. Syntactic e-mail address "validation" is one of the most
>> useless and widely broken things on the Interwebs. People who do
>> any
On 2023-11-04, Michael Torrie via Python-list wrote:
> On 11/4/23 02:51, Simon Connah via Python-list wrote:
>
>> Wow. I'm half tempted to make a weird email address to see how many
>> websites get it wrong.
In my experience, they don't have to be very weird at all.
>> Thank you for the link.
>
On 2023-11-02, Michael Torrie via Python-list wrote:
> On 11/2/23 00:42, Simon Connah via Python-list wrote:
>
>> Valid as in conforms to the standard. Although having looked at the
>> standard that might be more difficult than originally planned.
>
> You'll have to read the relevant RFCs. Lots o
On 2023-11-01, Chris Angelico via Python-list wrote:
> On Thu, 2 Nov 2023 at 08:09, Grant Edwards via Python-list
> wrote:
>> Make sure it has an '@' in it. Possibly require at least one '.'
>> after the '@'.
>
> No guarantee that there
On 2023-11-01, Simon Connah via Python-list wrote:
> I'm building a simple project using smtplib and have a
> question. I've been doing unit testing but I'm not sure how to check
> if an email message is valid.
Send an e-mail using it? If the right person gets the e-mail, then
it's valid?
> Us
On 2023-10-25, o1bigtenor via Python-list wrote:
> Haven't heard of a python IDE - - - doesn't mean that there isn't such - -
> just that I haven't heard of such. Is there a python IDE?
Seriously? Now you're just trolling.
google.com/search?q=python+ide&oq=python+ide
--
Grant
--
https://mail
On 2023-10-24, o1bigtenor via Python-list wrote:
> So how does one test software then?
That's what customers are for!
[Actually, that's true more often than it should be.]
--
https://mail.python.org/mailman/listinfo/python-list
On 2023-10-24, Thomas Passin via Python-list wrote:
> Something less ambitious than a full proof of correctness of an
> arbitrary program can sometimes be achieved. The programming team
> for the Apollo moon mission developed a system which, if you would
> write your requirements in a certain wa
On 2023-10-24, Dan Purgert via Python-list wrote:
> On 2023-10-24, o1bigtenor wrote:
>> Greetings
>>
>> (Sorry for a nebulous subject but dunno how to have a short title for
>> a complex question.)
>> [...]
>> Is there a way to verify that a program is going to do what it is
>> supposed to do even
On 2023-10-24, o1bigtenor via Python-list wrote:
> Is there a way to verify that a program is going to do what it is
> supposed to do even before all the hardware has been assembled and
> installed and tested?
It depends on what you mean by "verify ...". If you want to prove a
program correct (
On 2023-08-04, Chris Angelico via Python-list wrote:
> On Sat, 5 Aug 2023 at 09:36, dn via Python-list
> wrote:
>
>> Faced with a situation where an argument may be a scalar-value or an
>> iterable, I'll presume the latter, eg throw it straight into a for-loop.
>> If that fails (because the argu
On 2023-06-21, Chris Angelico via Python-list wrote:
> On Thu, 22 Jun 2023 at 02:54, Dan Kolis via Python-list
> wrote:
>>
>> Why do we tolerate this spam ?
>>
>> this seems most likely a way to inject viruses into people's workflow.
>>
>> That wiped out usenet. Ahh without an explaination; ( and
77 matches
Mail list logo