Re: Why can't the pointer in a PyCapsule be NULL?

2022-12-30 Thread Robert Latest via Python-list
ent in the body. Makes sense. > . On a superficial level, the answer is: "Because > PyCapsule_GetPointer uses NULL to indicate failure." Makes sense, too. Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Why can't the pointer in a PyCapsule be NULL?

2022-12-30 Thread Robert Latest via Python-list
Hi all, the question is in the subject. I'd like the pointer to be able to be NULL because that would make my code slightly cleaner. No big deal though. -- https://mail.python.org/mailman/listinfo/python-list

To clarify how Python handles two equal objects

2023-01-10 Thread Jen Kris via Python-list
I am writing a spot speedup in assembly language for a short but computation-intensive Python loop, and I discovered something about Python array handling that I would like to clarify.  For a simplified example, I created a matrix mx1 and assigned the array arr1 to the third row of the matrix

Re: To clarify how Python handles two equal objects

2023-01-10 Thread Jen Kris via Python-list
Thanks for your comments.  I'd like to make one small point.  You say: "Assignment in Python is a matter of object references. It's not "conform them as long as they remain equal". You'll have to think in terms of object references the entire way." But w

Re: To clarify how Python handles two equal objects

2023-01-10 Thread Jen Kris via Python-list
0, 2023, 13:59 by li...@tompassin.net: > Just to add a possibly picky detail to what others have said, Python does not > have an "array" type. It has a "list" type, as well as some other, not > necessarily mutable, sequence types. > > If you want to speed up list and

Re: To clarify how Python handles two equal objects

2023-01-11 Thread Jen Kris via Python-list
Yes, I did understand that.  In your example, "a" and "b" are the same pointer, so an operation on one is an operation on the other (because they’re the same memory block).  My issue in Python came up because Python can dynamically change one or the other to a different obje

Re: To clarify how Python handles two equal objects

2023-01-11 Thread Jen Kris via Python-list
e precise, an operation on one name will be reflected in the other name.  The difference is in the names,  not the pointers.  Each name has the same pointer in my example, but operations can be done in Python using either name.  Jan 11, 2023, 09:13 by r...@roelschroeven.net: > Op 11/01/2

RE: To clarify how Python handles two equal objects

2023-01-13 Thread Jen Kris via Python-list
s[middle_by_two] x = id(q) y = id(b) Now "x" and "y" are different, as we would expect.  So when writing a spot speed up in a compiled language, you can see in the Python source if either is reassigned, so you’ll know how to handle it.  The motivation behind my question wa

Re: To clarify how Python handles two equal objects

2023-01-13 Thread Jen Kris via Python-list
34 >   >>> b=1234 >   >>> a is b >   False > > Not sure what happens if you manipulate the data referenced by 'b' in the > first example thinking you are changing something referred to by 'a' ... but > you might be smart to NOT th

RE: To clarify how Python handles two equal objects

2023-01-14 Thread Jen Kris via Python-list
original post is limited to a case such as x = y where both "x" and "y" are arrays – whether they are lists in Python, or from the array module – and the question in a compiled C extension is whether the assignment can be done simply by "x" taking the pointer to &

Re: To clarify how Python handles two equal objects

2023-01-14 Thread Jen Kris via Python-list
Yes, in fact I asked my original question – "I discovered something about Python array handling that I would like to clarify" -- because I saw that Python did it that way.  Jan 14, 2023, 15:51 by ros...@gmail.com: > On Sun, 15 Jan 2023 at 10:32, Jen Kris via Python-list >

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
; > [ >{ "value": "some_key", 'a':1, 'b':2}, >{ "value": "some_other_key", 'a':3, 'b':4} > ] [{"value": key, **value} for d in input_data for key, value in d.items()] -- https://mail.python.org/mailman/listinfo/python-list

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 Rob Cliffe via Python-list
#x27;a':1, 'b':2},   { "value": "some_other_key", 'a':3, 'b':4} ] Assuming that I believe the above, rather than the code below, this works: listOfDescriptors = [     { **  (L := list(D.items())[0])[1], **{'value' : L[0] } }     for D

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-24 Thread Mike Baskin via Python-list
getopt for the option stuff. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-24 Thread Mike Baskin via Python-list
o_stuff_with(sys.argv[1:]) > > What is argparse really doing for you? I second this.  "if '-h' in sys.argv:"  is usually what I do. Alternatively, you could use "--arg=" syntax and place your string "-4^2+5.3*abs(-2-1)/2" its right-hand side": infix2postfix [options] "--infix=-4^2+5.3*abs(-2-1)/2" This shouldn't be too hard for a user to work with.  You could scan the argument list for the presence of "--infix=" and display the help message if it isn't there. -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: bool and int

2023-01-24 Thread Mike Baskin via Python-list
Will all of you please stop sending me emails Sent from my iPhone > On Jan 24, 2023, at 2:59 PM, rbowman wrote: > > On Mon, 23 Jan 2023 23:22:00 -0500, Dino wrote: > >> $ python Python 3.8.10 (default, Mar 15 2022, 12:22:08) >> [GCC 9.4.0] on linux Type "hel

Re: Evaluation of variable as f-string

2023-01-27 Thread Rob Cliffe via Python-list
On 25/01/2023 19:38, Thomas Passin wrote: Stack overflow to the rescue: Search phrase:  "python evaluate string as fstring" https://stackoverflow.com/questions/47339121/how-do-i-convert-a-string-into-an-f-string def effify(non_f_str: str):     return eval(f'f""

Re: bool and int

2023-01-27 Thread Rob Cliffe via Python-list
On 24/01/2023 04:22, Dino wrote: $ python Python 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> b = True >>> isinstance(b,bool) True >>>

Re: Evaluation of variable as f-string

2023-01-27 Thread Rob Cliffe via Python-list
rden - to support a relatively rare requirement". Perhaps someone will be inspired to write a function to do it. 😎 Best wishes Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: Evaluation of variable as f-string

2023-01-27 Thread Rob Cliffe via Python-list
Whoa! Whoa! Whoa! I appreciate the points you are making, Chris, but I am a bit taken aback by such forceful language. On 27/01/2023 19:18, Chris Angelico wrote: On Sat, 28 Jan 2023 at 05:31, Rob Cliffe via Python-list wrote: On 23/01/2023 18:02, Chris Angelico wrote: Maybe, rather than

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

2023-01-28 Thread Jon Ribbens via Python-list
appear in the list archive on the web. https://mail.python.org/pipermail/python-list/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Usenet vs. Mailing-list

2023-01-28 Thread Jon Ribbens via Python-list
. Although sometimes it does feel like it isn't, in that I reply to a post with an answer and then several other people reply significantly later with the same answer, as if my one had never existed... but whenever I check into it, my message has actually always made it to the list. -- https://mail.python.org/mailman/listinfo/python-list

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

Re: evaluation question

2023-01-30 Thread Rob Cliffe via Python-list
l of converting the print command in python 2 into a function in python 3 if as a function print() doesn't return anything useful? Surely even the length of the formatted string as per C's sprintf() function would be helpful? That's a fair question, or rather 2 fair questions. Ther

Re: Evaluation of variable as f-string

2023-01-31 Thread Rob Cliffe via Python-list
On 27/01/2023 23:41, Chris Angelico wrote: On Sat, 28 Jan 2023 at 10:08, Rob Cliffe via Python-list wrote: Whoa! Whoa! Whoa! I appreciate the points you are making, Chris, but I am a bit taken aback by such forceful language. The exact same points have already been made, but not listened to

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 ch

Re: Licensing?

2023-02-02 Thread Jon Ribbens via Python-list
what remains, pretty much by definition, isn't going to be useful. You'd be better off simply starting from scratch and having an unimpeachable claim to own the entire copyright yourself. -- https://mail.python.org/mailman/listinfo/python-list

Re: Organizing modules and their code

2023-02-04 Thread Greg Ewing via Python-list
devoted to each fruit, but only ever one crate of fruit in each aisle, one would think they could make better use of their shelf space. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Organizing modules and their code

2023-02-05 Thread Greg Ewing via Python-list
part of it, and that was something he saw his colleagues failing to do. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: evaluation question

2023-02-06 Thread Rob Cliffe via Python-list
en retained for X versions of 3 just as C++ keeps old stuff until its eventually deprecated them removed. Yeah?  So what would this do:     print () In Python 2 this prints an empty tuple. In Python 3 this is a call to the print function with no arguments, which prints a blank line. You can'

Re: Evaluation of variable as f-string

2023-02-07 Thread Rob Cliffe via Python-list
f all available variables and their values?  If it were possible, it could be useful, and there would be no impact on Python run-time speed if it were only constructed on demand. Best wishes Rob -- https://mail.python.org/mailman/listinfo/python-list

Re: evaluation question

2023-02-07 Thread Rob Cliffe via Python-list
On 07/02/2023 08:15, Chris Angelico wrote: On Tue, 7 Feb 2023 at 18:49, Rob Cliffe via Python-list wrote: On 02/02/2023 09:31, mutt...@dastardlyhq.com wrote: On Wed, 1 Feb 2023 18:28:04 +0100 "Peter J. Holzer" wrote: --b2nljkb3mdefsdhx Content-Type: text/plain; charset=us-asc

Re: ChatGPT Generated news poster code

2023-02-10 Thread Greg Ewing via Python-list
For a moment I thought this was going to be a script that uses ChatGPT to generate a random news post and post it to Usenet... Which would also have been kind of cool, as long as it wasn't overused. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: ChatGPT Generated news poster code

2023-02-12 Thread Roland Müller via Python-list
Hello, On 2/11/23 03:31, Greg Ewing via Python-list wrote: For a moment I thought this was going to be a script that uses ChatGPT to generate a random news post and post it to Usenet... Which would also have been kind of cool, as long as it wasn't overused. Actually, I like cynical humo

Python 3.8 pip installation on Windows 7

2023-02-14 Thread christoph sobotta via Python-list
Hello, The installation file Python-3.8.10.exe (last version compatible with Windows 7 (32 bit) ? ) does not automatically install pip on Windows 7. Are there compatibility problems with Windows 7 ? See attachment log file Greetings C.Sobotta ... MSI (s) (3C:FC) [13:32:28:993]: Hello, I'm

Re: Comparing caching strategies

2023-02-16 Thread Rob Cliffe via Python-list
future awaits [pun not intended] ... -- https://mail.python.org/mailman/listinfo/python-list

Re: Precision Tail-off?

2023-02-17 Thread Greg Ewing via Python-list
ar problem, since 1/3 isn't exactly representable in decimal either. To avoid it you would need to use an algorithm that computes nth roots directly rather than raising to the power 1/n. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: LRU cache

2023-02-18 Thread Rob Cliffe via Python-list
rt-Jan _cache.get(arg) should be a little faster and use slightly fewer resources than the try/except. Provided that you can provide a default value to get() which will never be a genuine "result". -- https://mail.python.org/mailman/listinfo/python-list

Line continuation and comments

2023-02-22 Thread Robert Latest via Python-list
ines terms which of course isn't possible because the backslash must be the last character on the line. Question: If the Python syntax were changed to allow comments after line-ending backslashes, would it break any existing code? I can't think of an example. -- https://mail.python.

Re: semi colonic

2023-02-22 Thread Rob Cliffe via Python-list
On 23/02/2023 02:04, Thomas Passin wrote: On 2/22/2023 7:58 PM, avi.e.gr...@gmail.com wrote: So can anyone point to places in Python where a semicolon is part of a best or even good way to do anything?  I use the semicolon (once in a while) is for quick debugging.  I might add as line

Re: Introspecting the variable bound to a function argument

2023-02-22 Thread Greg Ewing via Python-list
v2 the term [call by name] suggests this should be possible. But Python doesn't use call-by-name or anything remotely like it. (Even if it did, the word "name" in that context doesn't mean what it sounds like it means. The Algol docs used some words in weird ways.) -- G

Re: semi colonic

2023-02-22 Thread Greg Ewing via Python-list
the other hand, if they really want to, they will still be able to abuse semicolons by doing this sort of thing: a = 5; pass b = 7; pass c = a * b; pass Then everyone will know it's some really serious code! -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-22 Thread Greg Ewing via Python-list
On 23/02/23 9:37 am, Hen Hanna wrote: for the first several weeks... whenever i used Python... all i could think ofwas this is really Lisp (inside) with a thin veil of Java/Pascal syntax.. - that everything is first

Re: LRU cache

2023-02-22 Thread Rob Cliffe via Python-list
On 18/02/2023 17:19, Albert-Jan Roskam wrote: On Feb 18, 2023 17:28, Rob Cliffe via Python-list wrote: On 18/02/2023 15:29, Thomas Passin wrote: > On 2/18/2023 5:38 AM, Albert-Jan Roskam wrote: >>     I sometimes use this trick, which I learnt from a book by

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-23 Thread Rob Cliffe via Python-list
On 22/02/2023 20:05, Hen Hanna wrote: Python makes programming (debugging) so easy I agree with that! Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: semi colonic

2023-02-23 Thread Rob Cliffe via Python-list
On 23/02/2023 00:58, avi.e.gr...@gmail.com wrote: So can anyone point to places in Python where a semicolon is part of a best or even good way to do anything? Yes.  Take this bit of toy code which I just dreamed up.  (Of course it is toy code; don't bother telling me how it could be wr

Re: semi colonic

2023-02-23 Thread Rob Cliffe via Python-list
notwithstanding that IMO it is occasionally appropriate). Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: Line continuation and comments

2023-02-23 Thread Rob Cliffe via Python-list
On 22/02/2023 15:23, Paul Bryan wrote: Adding to this, there should be no reason now in recent versions of Python to ever use line continuation. Black goes so far as to state "backslashes are bad and should never be used": https://black.readthedocs.io/en/stable/the_black_

Re: semi colonic

2023-02-23 Thread Greg Ewing via Python-list
On 24/02/23 9:26 am, avi.e.gr...@gmail.com wrote: Python One-Liners: Write Concise, Eloquent Python Like a Professional Illustrated Edition by Christian Mayer (Author) I didn't know there were any Professional Illustrated Editions writing Pythom. You learn something every day! :-) --

Re: TypeError: can only concatenate str (not "int") to str

2023-02-25 Thread Greg Ewing via Python-list
go out of their way to read the tutor list -- something that is not of personal benefit to them. Also, pointing people towards tutor lists, if not done carefully, can give the impression of saying "newcomers are not welcome here". That's not a message we want to send to Python n

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 san

Re: Is there a more efficient threading lock?

2023-02-25 Thread Jon Ribbens via Python-list
omic, I believe. But, I think it is better to not have any shared > mutables regardless. I think it is the case that x += 1 is atomic but foo.x += 1 is not. Any replacement for the GIL would have to keep the former at least, plus the fact that you can do hundreds of things like list.append(foo) which are all effectively atomic. -- https://mail.python.org/mailman/listinfo/python-list

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

Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-27 Thread Greg Ewing via Python-list
sition, I think). The semantics of list comprehensions was originally defined in terms of nested for loops. A consequence was that the loop variables ended up in the local scope just as with ordinary for loops. Later it was decided to change that. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Line continuation and comments

2023-02-27 Thread Robert Latest via Python-list
lines and breaking them with the "\" line continuation character. In this >> context it would have been nice to be able to add comments to lines terms >> which of course isn't possible because the backslash must be the last >> character on the line. >> &

Re: Line continuation and comments

2023-02-27 Thread Robert Latest via Python-list
Paul Bryan wrote: > Adding to this, there should be no reason now in recent versions of > Python to ever use line continuation. Black goes so far as to state > "backslashes are bad and should never be used": > > https://black.readthedocs.io/en/stable/the_black_code_style/

Re: Line continuation and comments

2023-02-27 Thread Robert Latest via Python-list
Robert Latest wrote: > Paul Bryan wrote: >> Adding to this, there should be no reason now in recent versions of >> Python to ever use line continuation. Black goes so far as to state >> "backslashes are bad and should never be used": >> >

How to escape strings for re.finditer?

2023-02-27 Thread Jen Kris via Python-list
print(match.start(), match.end()) I’ve tried several other attempts based on my reseearch, but still no match.  I don’t have much experience with regex, so I hoped a reg-expert might help.  Thanks, Jen -- https://mail.python.org/mailman/listinfo/python-list

Re: it seems like a few weeks ago... but actually it was more like 30 years ago that i was programming in C, and

2023-02-27 Thread Greg Ewing via Python-list
On 28/02/23 7:40 am, avi.e.gr...@gmail.com wrote: inhahe made the point that this may not have been the original intent for python and may be a sort of bug that it is too late to fix. Guido has publically stated that it was a deliberate design choice. The merits of that design choice can be

Re: Python 3.10 Fizzbuzz

2023-02-27 Thread Greg Ewing via Python-list
python.org/mailman/listinfo/python-list

Re: Python 3.10 Fizzbuzz

2023-02-27 Thread Rob Cliffe via Python-list
posite of the choice I make. -- ~Ethan~ I've never tried Black or any other code formatter, but I'm sure we wouldn't get on. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to escape strings for re.finditer?

2023-02-27 Thread Jen Kris via Python-list
Yes, that's it.  I don't know how long it would have taken to find that detail with research through the voluminous re documentation.  Thanks very much.  Feb 27, 2023, 15:47 by pyt...@mrabarnett.plus.com: > On 2023-02-27 23:11, Jen Kris via Python-list wrote: > >>

Re: How to escape strings for re.finditer?

2023-02-27 Thread Jen Kris via Python-list
_fixed_ string, not a > pattern/regexp. So why on earth are you using regexps to do your searching? > > The `str` type has a `find(substring)` function. Just use that! It'll be > faster and the code simpler! > > Cheers, > Cameron Simpson > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: How to escape strings for re.finditer?

2023-02-27 Thread Jen Kris via Python-list
string.count() only tells me there are N instances of the string; it does not say where they begin and end, as does re.finditer.  Feb 27, 2023, 16:20 by bobmellow...@gmail.com: > Would string.count() work for you then? > > On Mon, Feb 27, 2023 at 5:16 PM Jen Kris via Python-list <

Re: How to escape strings for re.finditer?

2023-02-27 Thread Jen Kris via Python-list
found + len(substring) > ... do whatever with start and end ... > pos = end > > Many people go straight to the `re` module whenever they're looking for > strings. It is often cryptic error prone overkill. Just something to keep in > mind. > > Cheers, > Cameron Simpson > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: one Liner: Lisprint(x) --> (a, b, c) instead of ['a', 'b', 'c']

2023-02-27 Thread Greg Ewing via Python-list
On 28/02/23 4:24 pm, Hen Hanna wrote: is it poss. to peek at the Python-list's messages without joining ? It's mirrored to the comp.lang.python usenet group, or you can read it through gmane with a news client. -- Greg -- https://mail.python.org/mailma

RE: How to escape strings for re.finditer?

2023-02-28 Thread Jen Kris via Python-list
b 27, 2023, 18:16 by avi.e.gr...@gmail.com: > Jen, > > Can you see what SOME OF US see as ASCII text? We can help you better if we > get code that can be copied and run as-is. > > What you sent is not terse. It is wrong. It will not run on any python > interpreter because you

Re: How to escape strings for re.finditer?

2023-02-28 Thread Jen Kris via Python-list
gt; 26 40 > > If you may have variable numbers of spaces around the symbols, OTOH, the > whole situation changes and then regexes would almost certainly be the best > approach. But the regular expression strings would become harder to read. > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: How to escape strings for re.finditer?

2023-02-28 Thread Jen Kris via Python-list
27;using_simple_loop(KEY, >> CORPUS)', globals=globals(), number=1000)) >>     print('using_re_finditer:', timeit.repeat(stmt='using_re_finditer(KEY, >> CORPUS)', globals=globals(), number=1000)) >> >> This does 5 runs of 1000 repetitions each, and reports the time in seconds >> for each of those runs. >> Result on my machine: >> >>     using_simple_loop: [0.1395295020792, 0.1306313000456, >> 0.1280345001249, 0.1318618002423, 0.1308461032626] >>     using_re_finditer: [0.00386140005233, 0.00406190124297, >> 0.00347899970256, 0.00341310216218, 0.003732001273] >> >> We find that in this test re.finditer() is more than 30 times faster >> (despite the overhead of regular expressions. >> >> While speed isn't everything in programming, with such a large difference in >> performance and (to me) no real disadvantages of using re.finditer(), I >> would prefer re.finditer() over writing my own. >> > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: How to escape strings for re.finditer?

2023-02-28 Thread Jon Ribbens via Python-list
hat should >> be the main conclusion here. > > It is interesting, though, how pre-processing the search pattern can > improve search times if you can afford the pre-processing. Here's a > paper on rapidly finding matches when there may be up to one misspelled > charact

Re: Python 3.10 Fizzbuzz

2023-03-01 Thread Jon Ribbens via Python-list
ns. The mysterious bit is that two of the above projects do nothing except change the default of the one configuration option that *does* exist (line length). I mean, "black"'s line-length choice of 88 is insane, but I don't see the point of creating new pypi projects that do nothing except run another project with a single option set! -- https://mail.python.org/mailman/listinfo/python-list

Re: How to fix this issue

2023-03-01 Thread Rob Cliffe via Python-list
On 01/03/2023 18:46, Thomas Passin wrote: If this is what actually happened, this particular behavior occurs because Python on Windows in a console terminates with a instead of the usual . I think you mean . -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.10 Fizzbuzz

2023-03-01 Thread Greg Ewing via Python-list
On 2/03/23 10:59 am, gene heskett wrote: Human skin always has the same color Um... no? -- Greg -- https://mail.python.org/mailman/listinfo/python-list

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

2023-03-01 Thread Jon Ribbens via Python-list
ay to implement locks (push the > locking all the way down to the CPU level). Indeed, I remember thinking it was very fancy when they added the SWP instruction to the ARM processor. -- https://mail.python.org/mailman/listinfo/python-list

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 >

Packing Problem

2023-03-02 Thread Rob Cliffe via Python-list
each of these words, in order, as a subsequence. It struck me as being rather hard for a homework problem, unless I'm missing something blindingly obvious. Here is what I came up with (I could have done with removeprefix/removesuffix but I'm stuck on Python 3.8 for now 🙁): # Pack.py

Re: Packing Problem

2023-03-02 Thread Rob Cliffe via Python-list
ne or len(res) < len(BestResult):     BestResult = res     return Initial + BestResult + Final print(Pack(['APPLE', 'PIE', 'APRICOT', 'BANANA', 'CANDY'])) Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: Which more Pythonic - self.__class__ or type(self)?

2023-03-02 Thread Greg Ewing via Python-list
e slightly more efficient, as it avoids a global lookup and a function call. But as always, measurement would be required to be sure. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Which more Pythonic - self.__class__ or type(self)?

2023-03-03 Thread Greg Ewing via Python-list
On 4/03/23 7:51 am, avi.e.gr...@gmail.com wrote: I leave you with the question of the day. Was Voldemort pythonic? Well, he was fluent in Parseltongue, which is not a good sign. I hope not, otherwise we'll have to rename Python to "The Language That Shall Not Be Named" an

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-04 Thread Greg Ewing via Python-list
On 5/03/23 5:12 pm, Dino wrote: I can do a substring search in a list of 30k elements in less than 2ms with Python. Is my reasoning sound? I just did a similar test with your actual data and got about the same result. If that's fast enough for you, then you don't need to do anyt

Re: Cryptic software announcements (was: ANN: DIPY 1.6.0)

2023-03-05 Thread Rob Cliffe via Python-list
uld be a good idea if software announcements would include a single paragraph (or maybe just a single sentence) summarizing what the software is and does. hp +1 Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: Cutting slices

2023-03-05 Thread Rob Cliffe via Python-list
On 05/03/2023 22:59, aapost wrote: On 3/5/23 17:43, Stefan Ram wrote:    The following behaviour of Python strikes me as being a bit    "irregular". A user tries to chop of sections from a string,    but does not use "split" because the separator might become    more c

Re: Bug 3.11.x behavioral, open file buffers not flushed til file closed.

2023-03-05 Thread Greg Ewing via Python-list
impose additional delays before the data actually gets written. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Cutting slices

2023-03-05 Thread Greg Ewing via Python-list
- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-06 Thread Greg Ewing via Python-list
/python-list

Re: Fast full-text searching in Python (job for Whoosh?)

2023-03-06 Thread Greg Ewing via Python-list
e a lot of overlap between entries containing "V" and entries containing "6", so you end up searching the same data multiple times. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Feature migration

2023-03-08 Thread Greg Ewing via Python-list
On 9/03/23 8:29 am, avi.e.gr...@gmail.com wrote: They seem to be partially copying from python a feature that now appears everywhere but yet strive for some backwards compatibility. They simplified the heck out of all kinds of expressions by using INDENTATION. It's possible this was at

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
rting the module is not modifying the built-in. If your Python has been compiled with gnu readline support, input() *already* provides recall and editing facilities. You only need to import the readline module if you want to change the configuration. Yes, it would be helpful if the docs fo

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
7;re Dutch?) -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
rasing something that the user didn't type in. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
/listinfo/python-list

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
On 10/03/23 1:46 pm, Grant Edwards wrote: That's not how it acts for me. I have to "import readline" to get command line recall and editing. Maybe this has changed? Or is platform dependent? With Python 3.8 on MacOSX I can use up arrow with input() to recall stuff I've t

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
On 10/03/23 2:57 pm, Chris Angelico wrote: import sys; "readline" in sys.modules Is it? Yes, it is -- but only when using the repl! If I put that in a script, I get False. My current theory is that it gets pre-imported when using Python interactively because the repl itself uses it

Re: Baffled by readline module

2023-03-09 Thread Greg Ewing via Python-list
for me. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

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

Re: =- and -= snag

2023-03-14 Thread Rob Cliffe via Python-list
it. +1 Whenever I see code with type hints, I have to edit them out, either mentally, or physically, to understand what the code is actually doing.  It's adding new syntax which I'm not used to and don't want to be forced to learn. Rob Cliffe -- https://mail.python.org/mailman/

Re: We can call methods of parenet class without initliaze it?

2023-03-15 Thread Greg Ewing via Python-list
u haven't initialised yet. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Q: argparse.add_argument()

2023-03-18 Thread Gisle Vanem via Python-list
I accidentally used 'argparse' like this in my Python 3.9 program: parser.add_argument ("-c, --clean", dest="clean", action="store_true") parser.add_argument ("-n, --dryrun", dest="dryrun", action="store_true") ins

Re: Q: argparse.add_argument()

2023-03-18 Thread Gisle Vanem via Python-list
'parser.add_argument ("-c, --clean", dest="clean", action="store_true")' error: "-c, --clean", 2 options are unsupported. BTW, accusing someone of 'trolling' is rather rude IMHO. And thanks to ChrisA for a nice and normal answer. -- --gv -- https://mail.python.org/mailman/listinfo/python-list

<    22   23   24   25   26   27   28   29   30   31   >