Correct syntax for pathological re.search()

2024-10-08 Thread Michael F. Stemper via Python-list
;\\sout\{", line): But the lines with that string keep coming through. What is the right syntax to properly escape the backslash and the left curly bracket? -- Michael F. Stemper No animals were harmed in the composition of this message. -- https://mail.python.org/mailman/listinfo/python-list

Re: Correct syntax for pathological re.search()

2024-10-08 Thread Michael F. Stemper via Python-list
On 07/10/2024 08.56, Stefan Ram wrote: "Michael F. Stemper" wrote or quoted: if not re.search("\\sout\{", line): So, if you're not down to slap an "r" before your string literals, you're going to end up doubling down on every backslash. Ne

Re: troglodytes

2024-08-13 Thread Michael Torrie via Python-list
On 8/13/24 3:24 AM, Robin Becker via Python-list wrote: > I am clearly one of the troglodytes referred to in recent discussions around > the PSF. I've been around in python land > for far too long, my eyesight fails etc etc. > > I feel strongly that a miscarriage of justice has been made in the 3

Re: IDLE: clearing the screen

2024-06-10 Thread Michael F. Stemper via Python-list
e at the very top of the screen, and the ">>>" prompt appears on the SECOND line. (This blank line is because the IDLE prints the blank value returned by "return ''" and adds a newline to it, as it does when printing the value of any expression.) Why hav

Re: IDLE: clearing the screen

2024-06-10 Thread Michael F. Stemper via Python-list
On 10/06/2024 09.32, Stefan Ram wrote: "Michael F. Stemper" wrote or quoted: On 08/06/2024 14.18, Rob Cliffe wrote: OK, here is the advanced version: import os class _cls(object):     def __repr__(self):         os.system('cls')         return '' cls = _

Re: A technique from a chatbot

2024-04-03 Thread Michael F. Stemper via Python-list
ta', 'epsilon', 'zeta', 'eta', 'theta'] >>> find_e(l) 'epsilon' >>> l = ['The','fan-jet','airline'] >>> find_e(l) Traceback (most recent call last): File "", line 1, in File "", line 2, in find_e IndexError: list index out of range >>> -- Michael F. Stemper If it isn't running programs and it isn't fusing atoms, it's just bending space. -- https://mail.python.org/mailman/listinfo/python-list

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

2024-03-25 Thread Michael F. Stemper via Python-list
long, long way to run' >>> d.keys() ['fa', 'mi', 'do', 're'] >>> d.values() ['a long, long way to run', 'a name I call myself', 'a deer, a female deer', 'a drop of golden sunshine'] >>> -- Michael F. Stemper Exodus 22:21 -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-23 Thread Michael Torrie via Python-list
On 12/22/23 20:16, rbowman via Python-list wrote: > On Fri, 22 Dec 2023 17:27:58 -0700, Michael Torrie wrote: > >> Using the py launcher as your Windows association with .py and.pyw files >> you can have multiple versions of python installed and everything works >> as it s

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-23 Thread Michael Torrie via Python-list
On 12/22/23 20:56, Thomas Passin via Python-list wrote: > It's just better not to make assumptions about which version of Python > will be running. Just specify it yourself when you can, and then you can > be sure. Precisely, which is why the shebang is so useful, even on Windows with py launche

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Michael Torrie via Python-list
On 12/22/23 07:02, Thomas Passin via Python-list wrote: > On my Windows 10 machine, Python scripts run without a shebang line. > Perhaps Windows 11 has added the ability to use one, but then you would > need to use the actual location of your Python executable. Yes if you associate .py or .pyw w

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Michael Torrie via Python-list
On 12/22/23 11:42, Thomas Passin via Python-list wrote: > There is some important context that is missing here. Python on Windows > does not normally install to that location. That is not even a Windows > path, neither by directory name nor by path separators. No, that's just the way the py la

Re: RE: Newline (NuBe Question)

2023-11-26 Thread Michael F. Stemper via Python-list
s, dicts. Also check out the collections library, eps. deque.[1] I was nodding along with the people saying "list of lists" until I reread this quote. A list of tuples seems most appropriate to me. [1] <https://gist.github.com/hemanth/3715502>, as quoted by Bill Lubanovic in

Re: xor operator

2023-11-13 Thread Michael Speer via Python-list
>AFAICT, it's not nothing at all to do with 'xor' in any sense. As much as I agree that the function needn't be in the base of python, I can easily follow the OP's logic on the function name. With two items in the iterator, it is a standard binary exclusive or. It is true if one of but not both

Re: xor operator

2023-11-13 Thread Michael Speer via Python-list
I don't think an exclusive-or/truthy-entries-count-checker needs to be a builtin by any stretch. >>> def xor( iterable, n = 1 ): ... return sum( map( bool, iterable ) ) == n Or if you insist on short circuiting: >>> def xor_ss( iterable, n = 1 ): ... for intermediate in itertools.accumulat

Re: on a tail-recursive square-and-multiply

2023-11-07 Thread Michael Torrie via Python-list
On 11/7/23 18:26, Julieta Shem via Python-list wrote: > For the first time I'm trying to write a tail-recursive > square-and-multiply and, even though it /seems/ to work, I'm not happy > with what I wrote and I don't seem to understand it so well. > > --8<---cut here---star

Re: Checking if email is valid

2023-11-04 Thread Michael Torrie via Python-list
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. > > Thank you for the link. Nearly all websites seem to reject simple correct email addresses such as myemail+sometext@example.domain. I like to u

Re: Checking if email is valid

2023-11-02 Thread Michael Torrie via Python-list
On 11/2/23 00:42, Simon Connah via Python-list wrote: > Basically I'm writing unit tests and one of them passess in a string > with an invalid email address. I need to be able to check the string > to see if it is a valid email so that the unit test passess. If you truly have managed to code an

Re: Checking if email is valid

2023-11-01 Thread Michael Torrie via Python-list
On 11/1/23 04:09, Simon Connah via Python-list wrote: > Hi, > > 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. Using regex sounds like a bad idea to me and the other options I found >

Re: Question(s)

2023-10-26 Thread Michael Torrie via Python-list
On 10/26/23 10:41, Michael Torrie wrote: > By the way you definitely can step > through MicroPython code one line at a time with a remote debugger, say > with Visual Studio Code. I meant to edit that bit out. After doing a bit more research, it appears remote debugging with MicroPytho

Re: Question(s)

2023-10-26 Thread Michael Torrie via Python-list
On 10/26/23 06:34, o1bigtenor wrote: > Interesting - - - - ". . . see if it runs." - - - that's the issue! > When the code is accessing sensors there isn't an easy way to > check that the code is working until one has done the all of the > physical construction. If I'm trying to control a pulsatio

Re: Question(s)

2023-10-25 Thread Michael F. Stemper via Python-list
to (12,5) is 13 The python ecosystem provides many tools to simplify writing and running unit tests. Somebody has already mentioned "unittest". I use this one all of the time. There are also "doctest", "nose", "tox", and "py.test" (none of which I&#

Re: Question(s)

2023-10-25 Thread Michael Torrie via Python-list
On 10/25/23 05:51, o1bigtenor via Python-list wrote: > Looks like I have another area to investigate. (grin!) > Any suggestions? Seems to me you're trying to run before you have learned to walk. Slow down, go to the beginning and just learn python, write some code, see if it runs. Go through the

Re: Question(s)

2023-10-25 Thread Michael F. Stemper via Python-list
an be proven correct or incorrect. But, there are a lot more that cannot. -- Michael F. Stemper Outside of a dog, a book is man's best friend. Inside of a dog, it's too dark to read. -- https://mail.python.org/mailman/listinfo/python-list

Re: Question(s)

2023-10-25 Thread Michael F. Stemper via Python-list
ped, I find this hard to believe. -- Michael F. Stemper Outside of a dog, a book is man's best friend. Inside of a dog, it's too dark to read. -- https://mail.python.org/mailman/listinfo/python-list

Re: Where I do ask for a new feature

2023-10-20 Thread Michael Torrie via Python-list
On 10/19/23 19:32, Bongo Ferno via Python-list wrote: > >> You can actually just do that with simple assignment! >> >> short_view = my_object.stuff.long_stuff.sub_object >> print(short_view.some_method()) > > but then have to delete the variable manually > > del short_view Why? It's just a

Re: error of opening Python

2023-09-26 Thread Michael F. Stemper via Python-list
3.6.9 (default, Mar 10 2023, 16:46:00) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> Didn't you get the ">>> " prompt? Once you get it, it shows that the Read, Evaluate, P

Re: Where is the error?

2023-08-07 Thread Michael Agbenike via Python-list
When i try to open a python script it either says theres no ctk module or no pip On Sun, Aug 6, 2023, 3:51 PM Peter J. Holzer via Python-list < python-list@python.org> wrote: > Mostly, error messages got a lot better in Python 3.10, but this one had > me scratching my head for a few minutes. > >

Re: Is npyscreen still alive?

2023-04-24 Thread Michael Torrie
On 4/24/23 08:04, Grant Edwards wrote: > Is putty running on Windows a "modern terminal emulator" in this > context? After observing some of the local IT types work, I suspect > that will be a common use-case for the app I'm working on. Yes, Putty qualifies as a "modern terminal emulator." It su

Re: Is npyscreen still alive?

2023-04-24 Thread Michael Torrie
On 4/21/23 15:57, Barry wrote: > Maybe this, recently lwn.net article, https://textual.textualize.io/ > I was planning to check it out. Textual definitely looks slick and modern. And with a modern terminal emulator it works quite well and is responsive. I'd definitely consider it for a TUI. But

Re: Christoph Gohlke and compiled packages

2023-04-11 Thread Michael Torrie
On 4/11/23 11:48, Oscar Benjamin wrote: > You can hardly blame a lot of people for doing this. A seb search for > "download python" gives this as the first hit: > https://www.python.org/downloads/ Very true, but it points to the difference between how people install Python on Windows compared to L

Re: Windows Gui Frontend

2023-04-02 Thread Michael Torrie
On 2023-04-02 9:09 a.m., Dietmar Schwertberger wrote: >> I've tried wxGlade but never could get into it, or wxWidgets in general. > > Which version? Up to 0.7.2 I agree. Been a long time. I was initially turned off by the event handling system of wx compared to the signals and slots of Gtk and Qt

Re: Windows Gui Frontend

2023-04-02 Thread Michael Torrie
On 2023-04-02 9:09 a.m., Dietmar Schwertberger wrote: > That's what I hated with Qt Designer: it does not output Python code > but  a .ui file. > This was the point where I could not recommend it to anyone. Well the thing is you don't need to generate Python code at all. Qt provides a UI loader

Re: Windows Gui Frontend

2023-04-02 Thread Michael Torrie
On 4/1/23 09:37, Eryk Sun wrote: > Here are a few of the GUI toolkit libraries in common use: > > * tkinter (Tk) > * PyQt (Qt) > * PySide (Qt) > * wxPython (wxWidgets) > * PyGObject (GTK) > > tkinter is included in Python's standard library. Another good one is Kivy. Especia

Re: Windows Gui Frontend

2023-04-02 Thread Michael Torrie
On 4/2/23 05:09, Dietmar Schwertberger wrote: > I also did evaluate all the GUI builder from time to time between > 2000 and 2016 to find one that I could recommend to colleagues, > but could not find one. Then I started contributing to wxGlade > and I can say that since a few years it's as easy ag

Re: Windows Gui Frontend

2023-04-01 Thread Michael Torrie
On 4/1/23 15:33, Thomas Passin wrote: > OTOH, Qt isn't free for commercial use and the OP seems to be > speculating on coming up with a product to sell at some point. Careful. That's not actually true, even though the marketing team at Qt lets people believe it is. Qt is licensed under the LGPL,

Re: Rob Cliffe should stop sending me rude email messages.

2023-02-27 Thread Michael Torrie
On 2/27/23 09:17, Grant Edwards wrote: > On 2023-02-27, Michael Torrie wrote: > >> I've been putting off sending this message for days, but the list noise >> level is now to the point that it has to be said. > > Ah, I've finially realized why some of those thre

Re: Rob Cliffe should stop sending me rude email messages.

2023-02-27 Thread Michael Torrie
I've been putting off sending this message for days, but the list noise level is now to the point that it has to be said. Often it is better to contact someone directly and privately rather than publicly embarrass them by calling them out. You've made it clear, however, that publicly calling you o

Re: Is there a more efficient threading lock?

2023-02-26 Thread Michael Speer
1 (vv) is effectively locked/atomic on post-3.10 interpreters, though this is neither portable nor guaranteed to stay that way into the future On Sun, Feb 26, 2023 at 10:19 PM Michael Speer wrote: > I wanted to provide an example that your claimed atomicity is simply > wrong, but I found there is

Re: Is there a more efficient threading lock?

2023-02-26 Thread Michael Speer
I wanted to provide an example that your claimed atomicity is simply wrong, but I found there is something different in the 3.10+ cpython implementations. I've tested the code at the bottom of this message using a few docker python images, and it appears there is a difference starting in 3.10.0 p

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

2023-02-23 Thread Michael Torrie
On 2/23/23 01:08, Hen Hanna wrote: > Python VM is seeing an "int" object (123) (and telling me that) ... > so it should be easy to print that "int" object > What does Python VMknow ? and when does it know it ? It knows there is an object and its name and type. It knows this from t

Re: why is a search thru a Tuple slower ? ---- (meaningless indentations)

2023-02-20 Thread Michael Torrie
On 2/20/23 18:01, Hen Hanna wrote: > is Comp.Lang.Python very active Fairly. Apparently the cool kids are using the Python Discourse forum. > why is a linear search thru a Tuple slower > (than thru a (corresponding) List ) ??? I cannot say, unfortunately.

Re: is [comprehension] the right word???

2023-02-20 Thread Michael Torrie
On 2/20/23 18:06, Hen Hanna wrote: > is [comprehension] the right word??? > > i swear i never heard the word before > getting into Python a few years ago. Seems as though the term was borrowed from formal mathematics set theory. A simple search reveals that the term "list comprehen

Re: Tuple Comprehension ???

2023-02-20 Thread Michael Torrie
On 2/20/23 20:36, Hen Hanna wrote: > For a while, i've been curious about a [Tuple Comprehension] I've never heard of a "Tuple comprehension." No such thing exists as far as I know. > So finally i tried it, and the result was a bit surprising... > > > X= [ x for x in range(10) ] > X= (

Re: Precision Tail-off?

2023-02-17 Thread Michael Torrie
On 2/17/23 15:03, Grant Edwards wrote: > Every fall, the groups were again full of a new crop of people who had > just discovered all sorts of bugs in the way > implemented floating point, and pointing them to a nicely written > document that explained it never did any good. But to be fair, Goldb

Re: Precision Tail-off?

2023-02-17 Thread Michael Torrie
On 2/17/23 03:27, Stephen Tucker wrote: > Thanks, one and all, for your reponses. > > This is a hugely controversial claim, I know, but I would consider this > behaviour to be a serious deficiency in the IEEE standard. No matter how you do it, there are always tradeoffs and inaccuracies moving fr

Re: Precision Tail-off?

2023-02-14 Thread Michael Torrie
On 2/14/23 00:09, Stephen Tucker wrote: > I have two questions: > 1. Is there a straightforward explanation for this or is it a bug? To you 1/3 may be an exact fraction, and the definition of raising a number to that power means a cube root which also has an exact answer, but to the computer, 1/3 i

Re: Am I banned from Discuss forum?

2023-02-10 Thread Michael Torrie
On 2/10/23 14:10, Marco Sulla wrote: > I was banned from the mailing list and Discuss forum for a very long time. > Too much IMHO, but I paid my dues. > > Now this is my state in the forum: > - I never posted something unrespectful in the last months > - I have a limitation of three posts per thre

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

2023-01-27 Thread Michael Torrie
On 1/25/23 19:50, Jach Feng wrote: > To me, argparse has been just a tool which I can use in a CLI app. argparse is just a tool for dealing with command-line *flags*, which are common in command-line tools. argparse interprets the command line as a bunch of flags because that's what it's designe

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

2023-01-24 Thread Michael Torrie
On 1/23/23 18:58, Jach Feng wrote: > More pathonic, but don't work. The '--' must be at index 1:-) I'm very confused. Why are you even using argparse, since if you put -- at index 1 then argparse wont't do any argument parsing at all. If all you want is the expression on the command line, just a

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

2023-01-22 Thread Michael Torrie
On 1/22/23 11:44, Stefan Ram wrote: > Jach Feng writes: >> e:\Works\Python>py infix2postfix.py "-4^2+5.3*abs(-2-1)/2" > > Well, it's a nice exercise! But I only made it work for the > specific example given. I have not tested whether it always > works. Haha. Yes a nice exercise, but has n

Re: A natural magnet for the craziest TKinter lovers out there

2023-01-18 Thread Michael Torrie
On 1/18/23 18:01, Dan Kolis wrote: > Hangs after maybe between 4 and 50 screen rewrites. sometimes CTRL C under > Ubuntu starts it up again. Click go rewrites al the fonts the thing can find > in a few windows Repeated. > Not sure what you mean by "screen rewrites." I ran your test program

Re: Improvement to imports, what is a better way ?

2023-01-18 Thread Michael Torrie
On 1/18/23 14:42, Dan Kolis wrote: > >> I don't think you've described this. I don't know what you mean here. > > When I trace it in VSCode the imports seem like they endlessly suspend > scanning and go to other ones over and over. Like "Whats this doing ?" > Nothing to worry about there. Pyt

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-03 Thread Michael Torrie
On 1/3/23 11:45, Keith Thompson wrote: > MRAB writes: > [...] >> The purpose of stderr is to display status messages, logging and error >> messages, even user prompts, and not mess up the program's actual >> output. This is important on a *nix system where you might be piping >> the output of one

Re: Fwd: About the Python

2023-01-02 Thread Michael Torrie
On 1/1/23 22:27, Ramya M wrote: > This is from JNN College of Engineering, Shimoga. we are facing some > problems while using python. Please can you resolve this issue. Without any further information on your part, we can only guess at what the problems might be. Crystal ball says that Thomas' su

Re: String to Float, without introducing errors

2022-12-19 Thread Michael F. Stemper
quot;. For more detail, see: <https://en.wikipedia.org/wiki/Uncertainty#Measurements> -- Michael F. Stemper Isaiah 58:6-7 -- https://mail.python.org/mailman/listinfo/python-list

Re: Subject: problem activating python

2022-12-17 Thread Michael Torrie
On 12/17/22 15:45, Anne wrote: >I tried several times to install and use python for youtube views with Tor >using Youtube tutorials but I keep getting error after error. Please help >me. >regards Dimpho Given the lack of any information in your post, I can only assume you're trying

Re: Top level of a recursive function

2022-12-13 Thread Michael F. Stemper
On 13/12/2022 09.03, Stefan Ram wrote: "Michael F. Stemper" writes: def fred(cf,toplevel=True): x = cf[0] if len(cf)>1: if toplevel: return x + fred(cf[1:],False) else: return "(" + x + fred(cf[1:],False) + ")" else: if to

Top level of a recursive function

2022-12-13 Thread Michael F. Stemper
uot; + x + fred(cf[1:],False) + ")" else: if toplevel: return x else: return "(" + x + ")" Aside from being ugly, this lets the caller diddle with "toplevel", which shouldn't really be externally modifiable. Are there better ways to d

Re: Passing information between modules

2022-11-19 Thread Michael F. Stemper
n append to sys.argv. However, it seems like an incredibly bad idea. -- Michael F. Stemper The name of the story is "A Sound of Thunder". It was written by Ray Bradbury. You're welcome. -- https://mail.python.org/mailman/listinfo/python-list

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

2022-11-13 Thread Michael Speer
Python doesn't care what an expression returns. You've written an expression that returns the value of the 'clear' function that is bound to that particular list. The interpreter doesn't know or care if accessing that 'clear' attribute on the class returns a function or for some reason triggers a

Re: Any PyQt developers here?

2022-10-29 Thread Michael Torrie
On 10/28/22 21:31, DFS wrote: > I found one person that said they did it but their syntax didn't work. > But it doesn't throw an error either. > > model.setData(model.index(tblRow, col), font, Qt.FontRole) I wouldn't expect that to work but it's understandable why it didn't throw an error. setD

Re: Quick question about CPython interpreter

2022-10-17 Thread Michael Torrie
On 10/14/22 16:25, DFS wrote: > - > this does a str() conversion in the loop > - > for i in range(cells.count()): >if text == str(ID): > break > > > ---

Re: Find the path of a shell command

2022-10-13 Thread Michael Torrie
On 10/11/22 22:00, Paulo da Silva wrote: > 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 python program that launches a detached rm. It works pre

Re: Find the path of a shell command

2022-10-12 Thread Michael F. Stemper
in /usr/bin. On two different versions of Ubuntu, it's in /bin. -- Michael F. Stemper Psalm 94:3-6 -- https://mail.python.org/mailman/listinfo/python-list

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

2022-10-10 Thread Michael F. Stemper
ww.dabeaz.com/generators/Generators.pdf> -- Michael F. Stemper Life's too important to take seriously. -- https://mail.python.org/mailman/listinfo/python-list

Re: What to use for finding as many syntax errors as possible.

2022-10-10 Thread Michael F. Stemper
mething similar that I could do in python. -- Michael F. Stemper 87.3% of all statistics are made up by the person giving them. -- https://mail.python.org/mailman/listinfo/python-list

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

2022-10-09 Thread Michael Speer
>Well, the value is productivity. No need to save puzzles "what this >hanging else belongs to?" if you get to the point where it's hard to tell which else lines up with which if or for statement, I would suggest breaking things out into well-named helper functions rather than worrying over orderin

Re: TkSheet

2022-10-08 Thread Michael F. Stemper
On 08/10/2022 07.58, Benny Rieger wrote: What a great work;-) I need a solution for save my tabel as csv. How to do that? Has someone a solution for that? Is this what you're seeking? <https://www.pythontutorial.net/python-basics/python-write-csv-file/> -- Michael F. Stemper

Re: Regarding python 3.10 installation

2022-09-19 Thread Michael F. Stemper
password and IP address. -- Michael F. Stemper Psalm 82:3-4 -- https://mail.python.org/mailman/listinfo/python-list

Re: Coffee

2022-08-30 Thread Michael F. Stemper
cent video "Coffee with Brian Kernighan". For those who'd like to see the whole chat: <https://www.youtube.com/watch?v=GNyQxXw_oMQ> -- Michael F. Stemper Deuteronomy 24:17 -- https://mail.python.org/mailman/listinfo/python-list

Re: python 3.10 vs breakage

2022-08-26 Thread Michael Torrie
On 8/26/22 14:37, gene heskett wrote: > Greetings all; > > Its now become obvious that 3.10 has broken some things. I can't build > linuxcnc with it. And > Octoprint has quit talking to 3d printers, now pronterface won't buy it, > can't find a 4.0.7 > version of wxPython with it sitting there st

Re: Conecting to MySQL

2022-08-14 Thread Michael Torrie
On 8/8/22 19:26, Guilherme Campos wrote: > Hello folks, > > trying to connect to MYSQL it appears the error msg below: > InterfaceError: 2003: Can't connect to MySQL server on 'localhost:3306' > (111 Connection refused) > [image: conexao.png] > How can i fix that.? MySQL can listen on a local uni

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Michael F. Stemper
>>> to_try = [2,3,5,7,11,13,"seventeen",19] >>> choice(to_try) 2 >>> choice(to_try) 'seventeen' >>> choice(to_try) 13 >>> choice(to_try) 5 >>> -- Michael F. Stemper This sentence no verb. -- https://mail.python.org/mailman/listinfo/python-list

Re: calculate diff between dates

2022-07-14 Thread Michael F. Stemper
ates?" >>> import datetime >>> d1 = datetime.date(2022,1,1) >>> d2 = datetime.date(2022,7,12) >>> d2-d1 datetime.timedelta(192) >>> -- Michael F. Stemper If it isn't running programs and it isn't fusing atoms, it's just bending space. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why isn't there a built-in product()?

2022-07-09 Thread Michael F. Stemper
On 07/07/2022 19.06, Oscar Benjamin wrote: On Thu, 7 Jul 2022 at 22:55, Michael F. Stemper wrote: sum() is wonderful. I understand that there is no product() or prod(). Does anybody here know why that was not included in the language? It seems as if it would be useful, so there must have

Why isn't there a built-in product()?

2022-07-07 Thread Michael F. Stemper
Does anybody here know why that was not included in the language? It seems as if it would be useful, so there must have been some rationale for that decision. -- Michael F. Stemper 87.3% of all statistics are made up by the person giving them. -- https://mail.python.org/mailman/listinfo/python-list

Re: fill out bulletins

2022-06-13 Thread Michael F. Stemper
t, so that your recipients can (if they so desire) search on that text, or copy/paste from your bulletin. Somebody suggested TeX/LaTeX. Excellent idea. -- Michael F. Stemper A preposition is something you should never end a sentence with. -- https://mail.python.org/mailman/listinfo/python-list

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

2022-06-09 Thread Michael F. Stemper
/pprint.html from pprint import pprint pprint(thing) >>> from pprint import pprint >>> d = {'two':2, 'three':5} >>> pprint(d) {'three': 5, 'two': 2} >>> This is all on one line. That might be acceptable to the OP, but it doe

Re: min, max with position

2022-06-05 Thread Michael F. Stemper
On 04/06/2022 14.08, Stefan Ram wrote: "Michael F. Stemper" writes: Are there similar functions that return not only the minimum or maximum value, but also its position? The maximum value does not need to have a unique position. Which is something that I'll just ha

Re: min, max with position

2022-06-04 Thread Michael F. Stemper
On 04/06/2022 13.56, Dennis Lee Bieber wrote: On Sat, 4 Jun 2022 13:36:26 -0500, "Michael F. Stemper" declaimed the following: Are there similar functions that return not only the minimum or maximum value, but also its position? If it isn't in the library refer

min, max with position

2022-06-04 Thread Michael F. Stemper
lso its position? >>> specialmin(l) (0,1.618033) >>> specialmax(l) 3.141593 >>> -- Michael F. Stemper I feel more like I do now than I did when I came in. -- https://mail.python.org/mailman/listinfo/python-list

Re: Automatic Gain Control in Python?

2022-05-29 Thread Michael F. Stemper
as already shown the rudiments of urllib. Another option to consider is the use of something like curl or wget to download the podcasts, which can be automated separately from your replay program. -- Michael F. Stemper This email is to be read by its intended recipient only. Any other party reading i

Re: Request for assistance (hopefully not OT)

2022-05-21 Thread Michael Torrie
On 5/21/22 06:19, o1bigtenor wrote: > more useful - - - - well - - - - I don't have to wonder why 'linux' is > used as much > by the general populace as it is. The community likes to destroy > itself - - - it > is a pity - - - - the community has so much to offer. As far as community goes, the Lin

Re: "py" command for Linux and Mac?

2022-05-20 Thread Michael Torrie
On 5/12/22 11:59, De ongekruisigde wrote: > On 2022-05-12, Mats Wichmann wrote: >> On 5/12/22 10:25, Dan Stromberg wrote: >>> Hi folks. >>> >>> I heard there's a Windows-like "py" command for Linux (and Mac?). >>> >>> I'm finally getting to porting a particular project's Python 2.7 code to >>> 3.x

Re: Request for assistance (hopefully not OT)

2022-05-17 Thread Michael Torrie
On 5/17/22 05:20, o1bigtenor wrote: > What can I do to correct this self-inflicted problem? Those are always the fun ones. Reminds me of when I was first learning Linux using Red Hat Linux 5.0 or 5.1. This was long before nice dependency-solving tools like apt. I wanted to install and run StarO

Re: Changing calling sequence

2022-05-12 Thread Michael F. Stemper
function seems a lot simpler that any of my ideas. I think that I'll even use the name from your example. Thanks to all who posted, as well as the many lurkers who support me in email. -- Michael F. Stemper Economists have correctly predicted seven of the last three recessions. --

Changing calling sequence

2022-05-11 Thread Michael F. Stemper
risky, as well as being a bunch of work. (Admittedly, I'd only do it once.) The third is really klunky, but wouldn't need to touch anything besides this function. What are others' thoughts? Which of the approaches above looks least undesirable (and why)? Can anybody see a fourt

Re: Style for docstring

2022-04-24 Thread Michael F. Stemper
On 24/04/2022 08.24, Michael F. Stemper wrote: On 23/04/2022 12.43, Avi Gross wrote: Given what you added, Michael, your function is part of a larger collection of functions and being compatible with the others is a valid consideration. Whatever you decide, would ideally be done consistently

Re: Style for docstring

2022-04-24 Thread Michael F. Stemper
On 23/04/2022 12.43, Avi Gross wrote: Given what you added, Michael, your function is part of a larger collection of functions and being compatible with the others is a valid consideration. Whatever you decide, would ideally be done consistently with all or most of them. And, of course, it

Re: Style for docstring

2022-04-23 Thread Michael F. Stemper
On 22/04/2022 16.12, alister wrote: On Fri, 22 Apr 2022 14:36:27 -0500, Michael F. Stemper wrote: I'm writing a function that is nearly self-documenting by its name, but still want to give it a docstring. Which of these would be best from a stylistic point of view: for guidance I

Re: Style for docstring

2022-04-23 Thread Michael F. Stemper
nk about before breakfast, or even  after, odd as that may seem, ... I see what you did there :-> -- Michael F. Stemper Psalm 94:3-6 -- https://mail.python.org/mailman/listinfo/python-list

Re: Style for docstring

2022-04-22 Thread Michael F. Stemper
On 22/04/2022 14.59, Chris Angelico wrote: On Sat, 23 Apr 2022 at 05:56, Michael F. Stemper wrote: I'm writing a function that is nearly self-documenting by its name, but still want to give it a docstring. Which of these would be best from a stylistic point of view: Tells caller wh

Style for docstring

2022-04-22 Thread Michael F. Stemper
#x27;s odd.) Returns True if permutation is even, False if it is odd. (Before somebody suggests it, I'm not going to put six weeks' worth of a course in group theory in there to help somebody who doesn't know what those standard terms mean.) -- Michael F. Stemper 87.3% of all stat

Re: Feature Request

2022-03-23 Thread Michael F. Stemper
On 23/03/2022 03.55, Kazuya Ito wrote: Add "trun()" function to Python to truncate decimal part. Which of these should its behavior copy? from math import pi int(pi) 3 pi-int(pi) 0.14159265358979312 -- Michael F. Stemper This post contains greater than 95% post-consume

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-11 Thread Michael Torrie
On 3/11/22 11:03, Marco Sulla wrote: > Anyway I think I'll not install Debian, because it's LTS releases are > not long enough for me. I don't know if there's a distro based on > Debian that has a long LTS support, Ubuntu apart. Both Debian stable and Ubuntu LTS state they have a five year support

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Michael Torrie
On 3/10/22 12:42, Marco Sulla wrote: > PS: Is it just my impression or is there a plebiscite for Debian? A vote? No I don't think so. Not sure what you mean. The reason we're all suggesting Debian is because you specifically said you want a LTS Debian-like distro. Can't get any more Debian-like

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Michael Torrie
On 3/10/22 06:03, Marco Sulla wrote: > I tried Debian on a VM, but I found it too much basical. A little > example: it does not have the shortcut ctrl+alt+t to open a terminal > that Ubuntu has. I'm quite sure it's simple to add, but I'm starting > to be old and lazy... Debian has the same desktop

Re: PSA: Linux vulnerability

2022-03-09 Thread Michael Torrie
On 3/9/22 13:05, Marco Sulla wrote: > So my laziness pays. I use only LTS distros, and I update only when > there are security updates. > PS: any suggestions for a new LTS distro? My Lubuntu is reaching its > end-of-life. I prefer lightweight debian-like distros. Maybe Debian itself? -- https://

Re: Behavior of the for-else construct

2022-03-05 Thread Michael F. Stemper
cal, which was probably bigger in Germany and Austria in the 1980s than was C. -- Michael F. Stemper Psalm 94:3-6 -- https://mail.python.org/mailman/listinfo/python-list

Re: Behavior of the for-else construct

2022-03-04 Thread Michael F. Stemper
n binary, and those that can't. 1, 10, many. No problem. Ah, a George Gamow fan. -- Michael F. Stemper Psalm 82:3-4 -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   9   10   >