Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Jon Ribbens via Python-list
On 2022-10-24, Chris Angelico wrote: > On Mon, 24 Oct 2022 at 23:22, Peter J. Holzer wrote: >> Yes, I got that. What I wanted to say was that this is indeed a bug in >> html.parser and not an error (or sloppyness, as you called it) in the >> input or ambiguity in the HTML standard. > > I

Re: Beautiful Soup - close tags more promptly?

2022-10-24 Thread Jon Ribbens via Python-list
On 2022-10-24, Chris Angelico wrote: > On Tue, 25 Oct 2022 at 02:45, Jon Ribbens via Python-list > wrote: >> >> On 2022-10-24, Chris Angelico wrote: >> > On Mon, 24 Oct 2022 at 23:22, Peter J. Holzer wrote: >> >> Yes, I got that. What I want

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Michael F. Stemper wrote: > On 12/10/2022 07.20, Chris Green wrote: >> ... and rm will just about always be in /usr/bin. > > On two different versions of Ubuntu, it's in /bin. It will almost always be in /bin in any Unix or Unix-like system, because it's one of the fundamental

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Paulo da Silva wrote: > Às 05:00 de 12/10/22, Paulo da Silva escreveu: >> Hi! >> >> The simple question: How do I find the full path of a shell command >> (linux), i.e. how do I obtain the corresponding of, for example, >> "type rm" in command line? >> >> The reason: >> I have

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Joe Pfeiffer wrote: > Jon Ribbens writes: > >> On 2022-10-12, Michael F. Stemper wrote: >>> On 12/10/2022 07.20, Chris Green wrote: >>>> ... and rm will just about always be in /usr/bin. >>> >>> On two different versions o

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Paulo da Silva wrote: > Às 19:14 de 12/10/22, Jon Ribbens escreveu: >> On 2022-10-12, Paulo da Silva wrote: >>> Às 05:00 de 12/10/22, Paulo da Silva escreveu: >>>> Hi! >>>> >>>> The simple question: How do I find the full path

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Jon Ribbens wrote: > On 2022-10-12, Joe Pfeiffer wrote: >> Jon Ribbens writes: >> >>> On 2022-10-12, Michael F. Stemper wrote: >>>> On 12/10/2022 07.20, Chris Green wrote: >>>>> ... and rm will just about always be in /usr/bin.

Re: Find the path of a shell command

2022-10-12 Thread Jon Ribbens via Python-list
On 2022-10-12, Jon Ribbens wrote: > On 2022-10-12, Paulo da Silva wrote: >> Às 19:14 de 12/10/22, Jon Ribbens escreveu: >>> On 2022-10-12, Paulo da Silva wrote: >>>> Às 05:00 de 12/10/22, Paulo da Silva escreveu: >>>>> Hi! >>>>> >&

Re: Find the path of a shell command

2022-10-13 Thread Jon Ribbens via Python-list
On 2022-10-12, Paulo da Silva wrote: > Às 22:38 de 12/10/22, Jon Ribbens escreveu: >> On 2022-10-12, Jon Ribbens wrote: >>> On 2022-10-12, Paulo da Silva wrote: >>>> Às 19:14 de 12/10/22, Jon Ribbens escreveu: >>>>> On 2022-10-12, Paulo da Silva &g

Re: for -- else: what was the motivation?

2022-10-10 Thread Jon Ribbens via Python-list
On 2022-10-10, Calvin Spealman wrote: > On Sat, Oct 8, 2022 at 5:35 PM rbowman wrote: >> On 10/7/22 21:32, Axy wrote: >> > So, seriously, why they needed else if the following pieces produce same >> > result? Does anyone know or remember their motivation? >> >> In real scenarios there would be

Re: UTF-8 and latin1

2022-08-17 Thread Jon Ribbens via Python-list
On 2022-08-17, Tobiah wrote: > I get data from various sources; client emails, spreadsheets, and > data from web applications. I find that I can do some_string.decode('latin1') > to get unicode that I can use with xlsxwriter, > or put in the header of a web page to display > European characters

Re: FTP without username and password

2022-12-06 Thread Jon Ribbens via Python-list
On 2022-12-06, ^Bart wrote: > Hi Guys, > > usually I use this code on my Debian Bullseye: > > # python3 -m pyftpdlib -i 192.168.0.71 -p 21 -d /home/my_user/ftp > > It works, it's simply easy and perfect but... a device in my lan needs a > ftp folder without username and password! > > I tried to

Re: ok, I feel stupid, but there must be a better way than this! (finding name of unique key in dict)

2023-01-20 Thread Jon Ribbens via Python-list
On 2023-01-20, Dino wrote: > > let's say I have this list of nested dicts: > > [ >{ "some_key": {'a':1, 'b':2}}, >{ "some_other_key": {'a':3, 'b':4}} > ] > > I need to turn this into: > > [ >{ "value": "some_key", 'a':1, 'b':2}, >{ "value": "some_other_key", 'a':3, 'b':4} > ]

Re: Usenet vs. Mailing-list

2023-01-29 Thread Jon Ribbens via Python-list
On 2023-01-29, Peter J. Holzer wrote: > On 2023-01-29 02:09:28 -0000, Jon Ribbens via Python-list wrote: >> I'm not aware of any significant period in the last twenty-one years >> that > [the gateway] >> hasn't been working. Although sometimes it does feel like it i

Re: Usenet vs. Mailing-list (was: evaluation question)

2023-01-28 Thread Jon Ribbens via Python-list
On 2023-01-28, Peter J. Holzer wrote: > On 2023-01-27 21:04:58 +, Ben Bacarisse wrote: >> It looks like you posted this question via Usenet. comp.lang.python is >> essentially dead as a Usenet group. It exists, and gets NNTP versions >> of mail sent to the mailing list, but nothing posted

Re: Usenet vs. Mailing-list

2023-01-28 Thread Jon Ribbens via Python-list
On 2023-01-29, Ben Bacarisse wrote: > "Peter J. Holzer" writes: > >> On 2023-01-27 21:04:58 +, Ben Bacarisse wrote: >>> mutt...@dastardlyhq.com writes: >>> >>> > Hi >>> >>> It looks like you posted this question via Usenet. comp.lang.python is >>> essentially dead as a Usenet group. It

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Jon Ribbens via Python-list
On 2022-11-14, Stefan Ram wrote: > Jon Ribbens writes: >>"""Create an array and print its length""" >>array = [1, 2, 3] >>array.clear > > BTW: Above, there are /two/ expression statements > with no effect; the other one is >

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-13 Thread Jon Ribbens via Python-list
On 2022-11-13, DFS wrote: > On 11/13/2022 5:20 PM, Jon Ribbens wrote: >> On 2022-11-13, DFS wrote: >>> In code, list.clear is just ignored. >>> At the terminal, list.clear shows >>> >>> >>> >>> in code: >>> x = [1,2,3]

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-13 Thread Jon Ribbens via Python-list
On 2022-11-14, Greg Ewing wrote: > On 14/11/22 1:31 pm, Jon Ribbens wrote: >> On 2022-11-13, DFS wrote: >>> But why is it allowed in the first place? >> >> Because it's an expression, and you're allowed to execute expressions. > > To put it a bit more

Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-13 Thread Jon Ribbens via Python-list
On 2022-11-13, DFS wrote: > In code, list.clear is just ignored. > At the terminal, list.clear shows > > > > in code: > x = [1,2,3] > x.clear > print(len(x)) > 3 > > at terminal: > x = [1,2,3] > x.clear > > print(len(x)) > 3 > > > Caused me an hour of frustration before I noticed list.clear() was

Re: =- and -= snag

2023-03-14 Thread Jon Ribbens via Python-list
On 2023-03-13, Morten W. Petersen wrote: > I was working in Python today, and sat there scratching my head as the > numbers for calculations didn't add up. It went into negative numbers, > when that shouldn't have been possible. > > Turns out I had a very small typo, I had =- instead of -=. > >

Re: How to get get_body() to work? (about email)

2023-03-20 Thread Jon Ribbens via Python-list
On 2023-03-19, Stefan Ram wrote: > Jon Ribbens writes: >>(Also, I too find it annoying to have to avoid, but calling a local >>variable 'file' is somewhat suspect since it shadows the builtin.) > > Thanks for your remarks, but I'm not aware > of such a predefined name

Re: How to get get_body() to work? (about email)

2023-03-20 Thread Jon Ribbens via Python-list
On 2023-03-19, Stefan Ram wrote: > Peng Yu writes: >>But when I try the following code, get_body() is not found. How to get >>get_body() to work? > > Did you know that this post of mine here was posted to > Usenet with a Python script I wrote? > > That Python script has a function to show

Re: How to get get_body() to work? (about email)

2023-03-20 Thread Jon Ribbens via Python-list
On 2023-03-19, Greg Ewing wrote: > On 20/03/23 7:07 am, Jon Ribbens wrote: >> Ah, apparently it got removed in Python 3, which is a bit odd as the >> last I heard it was added in Python 2.2 in order to achieve consistency >> with other types. > > As far as I r

Re: Is there a more efficient threading lock?

2023-02-25 Thread Jon Ribbens via Python-list
On 2023-02-25, Paul Rubin wrote: > Skip Montanaro writes: >> from threading import Lock > > 1) you generally want to use RLock rather than Lock Why? > 2) I have generally felt that using locks at the app level at all is an > antipattern. The main way I've stayed sane in multi-threaded Python

Re: Is there a more efficient threading lock?

2023-02-25 Thread Jon Ribbens via Python-list
On 2023-02-25, Paul Rubin wrote: > Jon Ribbens writes: >>> 1) you generally want to use RLock rather than Lock >> Why? > > So that a thread that tries to acquire it twice doesn't block itself, > etc. Look at the threading lib docs for more info. Yes, I know what the

Re: Is there a more efficient threading lock?

2023-02-26 Thread Jon Ribbens via Python-list
On 2023-02-26, Chris Angelico wrote: > On Sun, 26 Feb 2023 at 16:16, Jon Ribbens via Python-list > wrote: >> On 2023-02-25, Paul Rubin wrote: >> > The GIL is an evil thing, but it has been around for so long that most >> > of us have gotten used to it, and

Re: Is there a more efficient threading lock?

2023-02-26 Thread Jon Ribbens via Python-list
On 2023-02-26, Barry Scott wrote: > On 25/02/2023 23:45, Jon Ribbens via Python-list wrote: >> I think it is the case that x += 1 is atomic but foo.x += 1 is not. > > No that is not true, and has never been true. > >:>>> def x(a): >:...    a += 1 >:... >

Re: Python 2.7 range Function provokes a Memory Error

2023-03-02 Thread Jon Ribbens via Python-list
On 2023-03-02, Stephen Tucker wrote: > The range function in Python 2.7 (and yes, I know that it is now > superseded), provokes a Memory Error when asked to deiliver a very long > list of values. > > I assume that this is because the function produces a list which it then > iterates through. > >

Re: Python 3.10 Fizzbuzz

2023-03-01 Thread Jon Ribbens via Python-list
On 2023-03-01, Simon Ward wrote: > On Tue, Feb 28, 2023 at 04:05:19PM -0500, avi.e.gr...@gmail.com wrote: >>Is it rude to name something "black" to make it hard for some of us to >>remind them of the rules or claim that our personal style is so often >>the opposite that it should be called

Re: How to escape strings for re.finditer?

2023-02-28 Thread Jon Ribbens via Python-list
On 2023-02-28, Thomas Passin wrote: > On 2/28/2023 10:05 AM, Roel Schroeven wrote: >> Op 28/02/2023 om 14:35 schreef Thomas Passin: >>> On 2/28/2023 4:33 AM, Roel Schroeven wrote: [...] (2) Searching for a string in another string, in a performant way, is not as simple as it first

Re: Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-01 Thread Jon Ribbens via Python-list
On 2023-03-02, Chris Angelico wrote: > On Thu, 2 Mar 2023 at 08:01, <2qdxy4rzwzuui...@potatochowder.com> wrote: >> On 2023-03-01 at 14:35:35 -0500, >> avi.e.gr...@gmail.com wrote: >> > What would have happened if all processors had been required to have >> > some low level instruction that

Re: Licensing?

2023-02-02 Thread Jon Ribbens via Python-list
On 2023-02-02, Stefan Ram wrote: > Many licenses in the Python world are like: "You can make > changes, but have to leave in my Copyright notice.". > > Would it be possible that the original author could not > claim a Copyright anymore when code has been changed? No. If you change

Re: Licensing?

2023-02-02 Thread Jon Ribbens via Python-list
On 2023-02-03, Greg Ewing wrote: > On 3/02/23 6:38 am, Jon Ribbens wrote: >> If you change someone else's code then you have created a derived >> work, which requires permission from both the original author and you >> to copy. (Unless you change it so much that nothing remai

Re: What to use instead of nntplib?

2023-05-22 Thread Jon Ribbens via Python-list
On 2023-05-22, Skip Montanaro wrote: >> My understanding is that nntplib isn't being erased from reality, >> it's merely being removed from the set of modules that are provided >> by default. >> >> I presume that once it's removed from the core, it will still be >> possible to install it via pip

Re: isinstance()

2023-08-04 Thread Jon Ribbens via Python-list
On 2023-08-02, dn wrote: > Can you please explain why a multi-part second-argument must be a tuple > and not any other form of collection-type? The following comment may hold a clue: if (PyTuple_Check(cls)) { /* Not a general sequence -- that opens up the road to

Bug in io.TextIOWrapper?

2023-06-19 Thread Jon Ribbens via Python-list
io.TextIOWrapper() wraps a binary stream so you can write text to it. It takes an 'encoding' parameter, which it uses to look up the codec in the codecs registry, and then it uses the IncrementalEncoder and IncrementalDecoder classes for the appropriate codec. The IncrementalEncoder.encode()

Re: Bug in io.TextIOWrapper?

2023-06-19 Thread Jon Ribbens via Python-list
On 2023-06-19, Inada Naoki wrote: > I checked TextIOWrapper source code and confirmed that it doesn't call > encoder.write(text, finish=True) on close. > Since TextIOWrapper allows random access, it is difficult to call it > automatically. So please think it as just limitation rather than bug. >

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Jon Ribbens via Python-list
On 2023-12-11, Chris Green wrote: > Chris Green 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',

Re: Await expressions (Posting On Python-List Prohibited)

2024-02-02 Thread Jon Ribbens via Python-list
On 2024-02-02, Lawrence D'Oliveiro wrote: > On 1 Feb 2024 10:09:10 GMT, Stefan Ram wrote: > >> Heck, even of the respected members of this newsgroup, IIRC, no one >> mentioned "__await__". > > It’s part of the definition of an “awaitable”, if you had looked that up. >

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

2024-03-25 Thread Jon Ribbens via Python-list
On 2024-03-25, Loris Bennett wrote: > "Michael F. Stemper" writes: > >> On 25/03/2024 01.56, Loris Bennett 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 >

Re: Timezone in HH:MM Format

2024-06-18 Thread Jon Ribbens via Python-list
On 2024-06-18, Ivan "Rambius" Ivanov wrote: > Hello, > > How can I convert a date, usually datetime.now(), into a format where > the timezone is in hours:minutes format. I was able to get that format > in shell: > > $ date +%Y-%m-%dT%H:%M:%S%:z > 2024-06-18T19:24:09-04:00 > > The closest I got in

<    2   3   4   5   6   7