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 (3/25/2024)

2024-03-27 Thread Dr. F. M. (Mike) Covington via Python-list
running Python 3.12: Mike ------ F. M. (Mike) Covington, PhD, PCPP, MCT Automation Consultant, Developer, Instructor -- 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: 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: 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 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: error of opening Python

2023-09-26 Thread Michael F. Stemper via Python-list
rint Loop (REPL) is ready for you to type some python statements. For instance: >>> x = 2**3 >>> print(x) 8 >>> -- 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: 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: 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: 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: 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: 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: 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
ation will cause an exception, so the function won't return. >>> d = {'1':'2', '2':'2', '3':'3'} >>> pg.ValidateDict(d) False >>> If I was to do it over, I would have named this function something like IsValidPermutation(), hiding the internal representation as well as making the function's Boolean nature explicit. -- Michael F. Stemper No animals were harmed in the composition of this message. -- https://mail.python.org/mailman/listinfo/python-list

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

Re: Behavior of the for-else construct

2022-03-03 Thread Michael F. Stemper
used it probably half-a-dozen times. It seems quite elegant to me. -- Michael F. Stemper A preposition is something you should never end a sentence with. -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to check if there is internet?

2022-02-25 Thread Michael F. Stemper
On 25/02/2022 14.30, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2022-02-25 at 13:48:32 -0600, "Michael F. Stemper" wrote: On 25/02/2022 12.07, Abdur-Rahmaan Janhangeer wrote: I have been following language feature proposals from various languages. Some decide to avoid Python&#x

Re: Best way to check if there is internet?

2022-02-25 Thread Michael F. Stemper
2007. As a side note, if by scripting we mean OS commands, then Python started as a sysadmin language. I never knew this. Where can I read more about this origin? -- Michael F. Stemper If it isn't running programs and it isn't fusing atoms, it's just bending space. -- https:

Re: Best way to check if there is internet?

2022-02-25 Thread Michael F. Stemper
On 25/02/2022 06.49, Abdur-Rahmaan Janhangeer wrote: Thanks for the in-between. I really like the Python comunity as, even though it's a 'scripting' language, To me, it's a programming language. In my usage, a "script" is a bunch of OS commands. -- Michael F. S

Re: XML Considered Harmful

2021-09-29 Thread Michael F. Stemper
On 28/09/2021 18.21, Greg Ewing wrote: On 29/09/21 4:37 am, Michael F. Stemper wrote: I'm talking about something made from tons of iron and copper that is oil-filled and rotates at 1800 rpm. To avoid confusion, we should rename them "electricity comprehensions". Hah! -- Mic

Re: XML Considered Harmful

2021-09-28 Thread Michael F. Stemper
paper that a friend of mine is submitting to various journals gets accepted by one of them, I'll end up with a 4 or 5 through him. However, as the months pass, it's looking more like mine will end up NaN. -- Michael F. Stemper Isaiah 58:6-7 -- https://mail.python.org/mailman/listinfo/python-list

Re: XML Considered Harmful

2021-09-28 Thread Michael F. Stemper
On 28/09/2021 10.53, Stefan Ram wrote: "Michael F. Stemper" writes: Well, I could continue to hard-code the data into one of the test programs One can employ a gradual path from a program with hardcoded data to an entity sharable by different programs. When I am hurried

Re: XML Considered Harmful

2021-09-28 Thread Michael F. Stemper
n fact, doing so points me to something written by a guy I worked with back in the 1980s: <http://www2.econ.iastate.edu/classes/econ458/tesfatsion/EconomicDispatchIntroToOptimization.DKirschen2004.LTEdits.pdf> Slide 3 even shows a piecewise-linear curve. -- Michael F. Stemper A preposition i

Re: XML Considered Harmful

2021-09-28 Thread Michael F. Stemper
s (or fuels) to a program. Multiple test cases are then just multiple files, all of which are available to multiple programs. You may of course want to save it, perhaps as a log, to show what your program was working on. That's another benefit of having the data in external files. -- Micha

Re: XML Considered Harmful

2021-09-27 Thread Michael F. Stemper
On 25/09/2021 16.48, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2021-09-25 at 15:20:19 -0500, "Michael F. Stemper" wrote: ... For instance, if I modeled a fuel like this: ton 21.96 18.2 and a generating unit

Re: XML Considered Harmful

2021-09-27 Thread Michael F. Stemper
cates tabular displays that I used through most of my career. Or, did I miss something and others have already produced the data using other tools, in which case you have to read it in at least once/ Well, the "tool" is vi, but this is a good description of what I'm doing. -- Michael

Re: XML Considered Harmful

2021-09-25 Thread Michael F. Stemper
On 21/09/2021 13.12, Michael F. Stemper wrote: If XML is not the way to package data, what is the recommended approach? Well, there have been a lot of ideas put forth on this thread, many more than I expected. I'd like to thank everyone who took the time to contribute. Most of the re

Re: XML Considered Harmful

2021-09-23 Thread Michael F. Stemper
On 23/09/2021 12.51, Eli the Bearded wrote: Am 22.09.21 um 16:52 schrieb Michael F. Stemper: On 21/09/2021 19.30, Eli the Bearded wrote: Yes, CSV files can model that. But it would not be my first choice of data format. (Neither would JSON.) I'd probably use XML. Okay. 'Go not to

Re: XML Considered Harmful

2021-09-23 Thread Michael F. Stemper
On 22/09/2021 17.37, Dennis Lee Bieber wrote: On Wed, 22 Sep 2021 09:52:59 -0500, "Michael F. Stemper" declaimed the following: On 21/09/2021 19.30, Eli the Bearded wrote: In comp.lang.python, Michael F. Stemper wrote: How does CSV handle hierarchical data? For instance, I have

Re: XML Considered Harmful

2021-09-22 Thread Michael F. Stemper
On 21/09/2021 19.30, Eli the Bearded wrote: In comp.lang.python, Michael F. Stemper wrote: I've heard of JSON, but never done anything with it. You probably have used it inadvertantly on a regular basis over the past few years. Websites live on it. I used to use javascript when

Re: XML Considered Harmful

2021-09-22 Thread Michael F. Stemper
On 21/09/2021 16.21, Pete Forman wrote: "Michael F. Stemper" writes: On 21/09/2021 13.49, alister wrote: On Tue, 21 Sep 2021 13:12:10 -0500, Michael F. Stemper wrote: It's my own research, so I can give myself the data in any format that I like. as far as I can see the main

Re: XML Considered Harmful

2021-09-21 Thread Michael F. Stemper
On 21/09/2021 13.49, alister wrote: On Tue, 21 Sep 2021 13:12:10 -0500, Michael F. Stemper wrote: On the prolog thread, somebody posted a link to: <https://dirtsimple.org/2004/12/python-is-not-java.html> One thing that it tangentially says is "XML is not the answer." I read

XML Considered Harmful

2021-09-21 Thread Michael F. Stemper
for something that it wasn't designed for? If XML is not the way to package data, what is the recommended approach? -- Michael F. Stemper Life's too important to take seriously. -- https://mail.python.org/mailman/listinfo/python-list

Re: Question again

2021-09-18 Thread Michael F. Stemper
" or number == "8" or number == "9" or number == "10" : print("I cannot sense any luck today, try again next time") Same here. This is, of course, why comments shouldn't just translate the code into English. They'll get out of synch. Instead, comments should say *why* the code is doing what it does. -- Michael F. Stemper Exodus 22:21 -- https://mail.python.org/mailman/listinfo/python-list

Re: on writing a while loop for rolling two dice

2021-09-04 Thread Michael F. Stemper
e do-while, but yeah --- it's not really worth it. Kernighan and Ritchie agree(d) with you. Per _The C Programming Language__: Experience shows that do-while is much less used that while and for. (Second edition, Section 3.6, page 63) -- Michael F. Stemper Outside of a dog, a book is man&#

Re: The sqlite3 timestamp conversion between unixepoch and localtime

2021-09-03 Thread Michael F. Stemper
get information/patches to our North American customers was annoying. [1] <https://www.congress.gov/bill/109th-congress/house-bill/6>, Sec 110 -- Michael F. Stemper If you take cranberries and stew them like applesauce they taste much more like prunes than rhubarb does. -- https://mail.python.org/mailman/listinfo/python-list

Re: urgent

2021-09-02 Thread Michael F. Stemper
cense" for more information. REPL> import sys # in the original, this line will be messed up REPL> sys.exit(0) # this one, too username@hostname$ -- Michael F. Stemper What happens if you play John Cage's "4'33" at a slower tempo? -- https://mail.python.org/mailman/listinfo/python-list

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-08-31 Thread Michael F. Stemper
/watch?v=-5wpm-gesOY> And amusingly. -- Michael F. Stemper Always remember that you are unique. Just like everyone else. -- https://mail.python.org/mailman/listinfo/python-list

Re: on slices, negative indices, which are the equivalent procedures?

2021-08-13 Thread Michael F. Stemper
shing Company; (c) 1981; Page 125 It also says that zero increments are not supported. (Whew!) -- 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: on slices, negative indices, which are the equivalent procedures?

2021-08-06 Thread Michael F. Stemper
mber there at all: >>> s[3::-1] 'kcaJ' >>> Or, it you want to be more explicit, you could separately grab the substring and then reverse it: >>> s[:4][::-1] 'kcaJ' >>> Does any of this help? -- 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: 'Pygame Module' not working

2021-07-31 Thread Michael F. Stemper
le not found Are you running your program in the parent directory of "assets"? What happens when you go into the python interpreter (REPL) and import pygame followed by executing that function? -- Michael F. Stemper Why doesn't anybody care about apathy? -- https://mail.python.org/mailman/listinfo/python-list

Rotation of a cube

2021-07-29 Thread Michael F. Stemper
[1], briefly showing each step. However, it seems to me that this is a solved problem, so there is probably a module that will do most of the scutwork for me. Any suggestions on where to find such a module? Thanks. [1] <https://mathworld.wolfram.com/RotationMatrix.html> -- Michael F. S

Syntactic sugar

2021-06-28 Thread Michael F. Stemper
morning, I had use for that syntax, but couldn't find it on-line or guess what it was. Does this syntax exist, or am I simply imagining things? Thanks, -- Michael F. Stemper There's no "me" in "team". There's no "us" in "team", either. -- https://mail.python.org/mailman/listinfo/python-list

Re: Syntactic sugar

2021-06-28 Thread Michael F. Stemper
On 28/06/2021 11.57, Stefan Ram wrote: "Michael F. Stemper" writes: for iter in range(n): chunkofcode When the counter does not matter, people sometimes write "_": for _ in range( n ): chunkofcode That looks like what I wanted. Thanks! -- Michael F. Stemp

Re: Optimizing Small Python Code

2021-06-23 Thread Michael F. Stemper
1\n 2\n 3\n 4\n 5\n' ) Unless I'm figuring ot wrong, you just took it from O(n^2) to O(1). That deserves a Turing award or something. -- Michael F. Stemper You can lead a horse to water, but you can't make him talk like Mr. Ed by rubbing peanut butter on his gu

Re: Python

2021-06-14 Thread Michael F. Stemper
, Linux, something else? Specific version. -- Michael F. Stemper You can lead a horse to water, but you can't make him talk like Mr. Ed by rubbing peanut butter on his gums. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python doesn't work

2021-05-30 Thread Michael F. Stemper
uess would be that the following happens: 1. You click on the file in some GUI. 2. The program contained in that file executes; taking a second or so. 3. Having done what you asked it to, it goes away. -- Michael F. Stemper 87.3% of all statistics are made up by the person giving them

Re: learning python ...

2021-05-27 Thread Michael F. Stemper
x27;t expect that ... The strange thing, coming from a different language, is the apparent difference, if instead of a list, you pass an integer: def f(a): a=5 l=3 f(l) print(l) > 3 Here, the "l" is not changed. The reason is that the statement "a=5" does NOT

Re: Turtle module

2021-05-26 Thread Michael F. Stemper
On 26/05/2021 13.24, Stefan Ram wrote: "Michael F. Stemper" writes: What I would like to do is capture the angle-representation mode on entry and restore it on return. another one: def f( turtle_ ): my_turtle = turtle_.clone() # now work with

Re: Turtle module

2021-05-26 Thread Michael F. Stemper
On 26/05/2021 11.17, Chris Angelico wrote: On Thu, May 27, 2021 at 1:59 AM Michael F. Stemper wrote: What I would like to do is capture the angle-representation mode on entry and restore it on return. However, looking through the methods of turtle.Turtle(), I can't find any mea

Turtle module

2021-05-26 Thread Michael F. Stemper
e to return with the pen in the same state (up or down) as when my functions were called. Again, I can't find any way to query the pen state. How can my function get this information? Or do I need to be sloppy and let the callers beware? -- Michael F. Stemper 2 Chronicles 19:7 -- https://mail.py

Re: learning python ...

2021-05-25 Thread Michael F. Stemper
On 24/05/2021 18.30, Alan Gauld wrote: On 24/05/2021 16:54, Michael F. Stemper wrote: In my early days of writing python, I created lists named "list", dictionaries named "dict", and strings named "str". I mostly know better now, but sometimes still need to restr

Re: learning python ...

2021-05-25 Thread Michael F. Stemper
java (Ack, spit) does the same thing. -- Michael F. Stemper Isaiah 10:1-2 -- https://mail.python.org/mailman/listinfo/python-list

Re: learning python ...

2021-05-24 Thread Michael F. Stemper
str In my early days of writing python, I created lists named "list", dictionaries named "dict", and strings named "str". I mostly know better now, but sometimes still need to restrain my fingers. -- Michael F. Stemper Nostalgia just ain't what it used to be. -- https://mail.python.org/mailman/listinfo/python-list

Re: Writers [Was: Re: Standarize TOML?]

2021-05-18 Thread Michael F. Stemper
On 18/05/2021 08.23, Jon Ribbens wrote: On 2021-05-18, Michael F. Stemper wrote: On 17/05/2021 18.48, Terry Reedy wrote: There are multiple packages.  There is no consensus on which to pick, *if any*. Existing modules apparently include writers, which are necessarily opinionated (as is

Writers [Was: Re: Standarize TOML?]

2021-05-18 Thread Michael F. Stemper
I could read up on them? [1] Well, I've used csv.DictWriter() which might be an instance. -- Michael F. Stemper Galatians 3:28 -- https://mail.python.org/mailman/listinfo/python-list

Re: Python script accessing own source code

2021-05-12 Thread Michael F. Stemper
rgv[0], "rt" ) as myself: for line in myself: junk = sys.stdout.write( "%s" % (line) ) sys.exit(0) It's not bullet-proof. If you put it in a directory in your $PATH and run it from somewhere else, it won't work. --

Re: Bloody rubbish

2021-05-06 Thread Michael F. Stemper
hat's what the sixteen toggle switches are for. -- Michael F. Stemper Life's too important to take seriously. -- https://mail.python.org/mailman/listinfo/python-list

Re: FileNotFoundError: [Errno 2] No such file or directory: ''

2021-04-14 Thread Michael F. Stemper
name. For instance, I might do saga = open(r'c:\my\dir\ect\ory\Egils Saga 1-15.txt', 'r') or even with open(r'c:\my\dir\ect\ory\Egils Saga 1-15.txt', 'r') as saga: The latter form eliminates the need for saga.close(). (I'm sure that you know that; it&#x

Re: error of opening Python

2021-02-25 Thread Michael F. Stemper
credits" or "license" for more information." I don't know what this meant and how to fix this. Could you please help me? There isn't anything to fix. It's working just fine. -- Michael F. Stemper If you take cranberries and stew them like applesauce they taste much more

Re: New Python implementation

2021-02-19 Thread Michael F. Stemper
cons. <https://www.youtube.com/watch?v=DcQDqZIN09I> -- Michael F. Stemper If you take cranberries and stew them like applesauce they taste much more like prunes than rhubarb does. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python cannot count apparently

2021-02-08 Thread Michael F. Stemper
lly help you with only guesses as to what you did. -- 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: Python cannot count apparently

2021-02-08 Thread Michael F. Stemper
s that the code you posted has very little to do with the code you ran. If you really want us to help, please directly copy and paste the exact code that you ran. We can't really help you with only guesses as to what you did. [1] (leading > replaced with . to fool news clients) -- Michael

Re: why sqrt is not a built-in function?

2021-01-16 Thread Michael F. Stemper
On 15/01/2021 17.17, dn wrote: On 16/01/2021 11.40, Michael F. Stemper wrote: On 15/01/2021 16.01, Chris Angelico wrote: On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper wrote: On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: On 15/01/2021 14.01, Stefan

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 16.01, Chris Angelico wrote: On Sat, Jan 16, 2021 at 8:56 AM Michael F. Stemper wrote: On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: On 15/01/2021 14.01, Stefan Ram wrote: __import__( "math" ).sqrt( 4 ) I had no idea that syntax

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 15.26, Stefan Ram wrote: "Michael F. Stemper" writes: On 15/01/2021 14.01, Stefan Ram wrote: __import__( "math" ).sqrt( 4 ) I had no idea that syntax existed, and find it completely at odds with The Zen of Python. I'm torn between forgetting that I eve

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.01, Stefan Ram wrote: "Michael F. Stemper" writes: Of these, only EcmaScript has Math.sqrt() as part of the language, and that could be partly due to the fact that the language doesn't have any concept of "import" or &

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.02, Chris Angelico wrote: On Sat, Jan 16, 2021 at 6:21 AM Michael F. Stemper wrote: Here's the status of the square root function in various languages, in the order that I encountered them: FORTRANPart of the language Pascal Part of the language SNOBOL Part o

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
On 15/01/2021 14.00, Chris Green wrote: Michael F. Stemper wrote: On 14/01/2021 13.00, Rob Cliffe wrote: On 14/01/2021 17:44, Denys Contant wrote: I don't understand why sqrt is not a built-in function. Why do we have to first import the function from the math module? I use it ALL THE

Re: why sqrt is not a built-in function?

2021-01-15 Thread Michael F. Stemper
e most use currently are c, EcmaScript, python, and Java. Of these, only EcmaScript has Math.sqrt() as part of the language, and that could be partly due to the fact that the language doesn't have any concept of "import" or "include". -- Michael F. Stemper This email is to be

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Michael F. Stemper
On 12/01/2021 10.40, Michael F. Stemper wrote: Modeling of electric power systems: - load behavior in response to conservation load reduction Sorry, that should have been "conservation voltage reduction". -- Michael F. Stemper Psalm 82:1-4 -- https://mail.python.org/mailman/listi

Re: A beginning beginner's question about input, output and . . .

2021-01-12 Thread Michael F. Stemper
- composition of permutations of a set - properties of minimal paths through a C_m x C_n lattice - generating tikz commands for geometric diagrams in TeX documents - unstructured and uneducated exploration of Conway's Game of Life -- Michael F. Stemper 2 Chronicles 19:7 -- https://mail.python.org/mailman/listinfo/python-list

Re: primitive password cracker

2021-01-09 Thread Michael F. Stemper
#x27;a', 'b', 'c', 'aa', 'ab', 'ac', 'aaa', 'aab', 'aac', 'aba', 'abb', 'abc', 'aca', 'acb', 'acc', 'ba', 'bb', 'bc', 'baa', 'bab', 'bac', 'bba', 'bbb', 'bbc', 'bca', 'bcb', 'bcc', 'ca', 'cb', 'cc', 'caa', 'cab', 'cac', 'cba', 'cbb', 'cbc', 'cca', 'ccb', 'ccc'] >>> words = embiggen(words) >>> len(words) 120 >>> It's obvious that this could be called from a for-loop with no modification, which I believe is what the OP wanted. -- Michael F. Stemper Deuteronomy 24:17 -- https://mail.python.org/mailman/listinfo/python-list

Re: dayofyear is not great when going into a new year

2021-01-09 Thread Michael F. Stemper
e "weekend". Starting on Sunday is weird for us, because then the weekend is split into the first and last day of the week (?) A week is like a piece of string. It has two ends. -- Michael F. Stemper Deuteronomy 24:17 -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   >