Re: Problem

2020-10-02 Thread Mirko via Python-list
Am 02.10.2020 um 11:58 schrieb Terry Reedy: > On 10/1/2020 4:09 PM, Mirko via Python-list wrote: > >> Renaming "IDLE" to "Python IDE" (or similar) might also. > "IDLE" intentionally echoes 'Idle', as in Eric Idle of Monty > Python. It sta

Re: Problem

2020-10-04 Thread Mirko via Python-list
; (or similar) to the desktop with shortcuts to Python, IDLE and the CHM. - Add a checkbox (default enabled) like "Start the IDLE Python Editor/Shell" at the end of the installation procedure. - Perhaps, if possible, add a button like "Start the IDLE Python Editor/Shell" to the Repair/Modify/Remove Dialog. So long and happy hacking! :-) -- https://mail.python.org/mailman/listinfo/python-list

Fwd: Python 3..9.0

2020-10-09 Thread Joe via Python-list
rg/mailman/listinfo/python-list

Re: file to bits text and text containing bits to file

2020-10-09 Thread dn via Python-list
everything else is done. Which (Python) tool(s) are you currently using? What (Python) research have you done? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: What might cause my sample program to forget that already imported datetime?

2020-10-12 Thread dn via Python-list
7;MINYEAR': 1, '__annotations__': {}, '__builtins__': , '__doc__': None, '__loader__': , '__name__': '__main__', '__package__': None, '__spec__': None, 'date': , 'datetime': , 'datetime_CAPI': 0x7fc3d1626ea0>, 'pp': , 'sys': , 'time': , 'timedelta': , 'timezone': , 'tzinfo': } Apologies for the awkward email word-wrap. Note the (absence and then) changing entry for 'datetime'. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: File Name issue

2020-10-18 Thread dn via Python-list
On 18/10/2020 12:58, Mladen Gogala via Python-list wrote: On Sat, 17 Oct 2020 22:51:11 +, Mladen Gogala wrote: On Sat, 17 Oct 2020 18:12:16 -0400, Steve wrote: with open("HOURLYLOG.txt", 'r') as infile: works but, when I rename the file, the line: with open("

Re: File Name issue

2020-10-18 Thread dn via Python-list
On 19/10/2020 05:58, Mladen Gogala via Python-list wrote: On Sun, 18 Oct 2020 21:00:18 +1300, dn wrote: On 18/10/2020 12:58, Mladen Gogala via Python-list wrote: On Sat, 17 Oct 2020 22:51:11 +, Mladen Gogala wrote: BTW, I used this cp /var/log/syslog ./in-file.log #!/usr/bin/env python3

Re: How to expand and flatten a nested of list of dictionaries of varied lengths?

2020-10-18 Thread dn via Python-list
, {u'name': u'Well-led', u'rating': u'Good'}, {u'name': u'Caring', u'rating': u'Good'}, {u'name': u'Responsive', u'rating': u'Requires improvement'}, {u'name': u'Effective', u'rating': u'Good'}], u'rating': u'Good'}, u'reportDate': u'2015-01-12', u'reportLinkId': u'a11c1e52-ddfd-4cd8-8b56-1b96ac287c96'}] You may find it helpful to use the pprint ("pretty printing" library to print data-structures in a more readable/structured format). To "flatten" a dictionary, you must first be sure that there will be no keys that will clash (else the second entry will completely replace the first, without trace). Thus, we will need to understand more about this particular definition of "flatten" in relation to the range of incoming data. Perhaps explain them in English first... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: How to expand and flatten a nested of list of dictionaries of varied lengths?

2020-10-18 Thread dn via Python-list
at we can't "snip" or 'do some gardening', to remove unnecessary or erroneous material, as the conversation progresses. You will notice (as below) that this also enables a posting with multiple questions, to be discussed point-by-point. Now to work... > On Sun, 18

Re: Help with the best practice to learn python

2020-10-19 Thread dn via Python-list
ons which might seem 'simple' to professionals and skilled-practitioners: https://mail.python.org/mailman/listinfo/tutor - I use the edX platform (for non-Python training) -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

GUI: I am also looking for a nudge into the best (GUI) direction.

2020-10-29 Thread flaskee via Python-list
oo far down the wrong path, if you good folks can help. Right now I am plugging away on Gtk to see where that takes me. Thank you for your help in advance! Sent with [ProtonMail](https://protonmail.com) Secure Email. -- https://mail.python.org/mailman/listinfo/python-list

Re: GUI: I am also looking for a nudge into the best (GUI) direction.

2020-10-29 Thread flaskee via Python-list
se platforms, plus Linux. Really, MOSTLY, for Linux. And I really want Python as the new core for most things. Thanks Sent with [ProtonMail](https://protonmail.com) Secure Email. -- https://mail.python.org/mailman/listinfo/python-list

Re: GUI: I am also looking for a nudge into the best (GUI) direction.

2020-10-30 Thread flaskee via Python-list
sages off list, and sending a self-composed > summary of the replies back to the list. > > -------

Best way to determine user's screensize?

2020-10-30 Thread flaskee via Python-list
MacOS, Windows or Linux (I think that I understand how to handle it for browser-based things.) As close to an all Python answer as possible, would be optimal. Thank you! -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to determine user's screensize?

2020-10-30 Thread flaskee via Python-list
nt fires when flipping to the side or back, that can then be reacted to, to reposition things. I just need to re-figure this all out under Python, et al. Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to determine user's screensize?

2020-10-30 Thread flaskee via Python-list
he geometry of that monitor monitor = s.get_monitor_geometry(m) # This is an example output print("Height: %s, Width: %s" % (monitor.height, monitor.width)) -- https://mail.python.org/mailman/listinfo/python-list

Re: Best way to determine user's screensize?

2020-10-30 Thread flaskee via Python-list
ibly crushed that you won't use my app(s) /s Bye, bye. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread dn via Python-list
On 31/10/2020 16:20, Chris Angelico wrote: On Sat, Oct 31, 2020 at 1:51 PM Jon Ribbens via Python-list wrote: On 2020-10-31, Stefan Ram wrote: Siddhharth Choudhary writes: I want to know why x+=1 does not return the value of the variable. Which value? The old or the new one

Re: Why x+=1 doesn't return x value instead of an object

2020-10-31 Thread dn via Python-list
On 31/10/2020 19:41, Chris Angelico wrote: On Sat, Oct 31, 2020 at 4:44 PM dn via Python-list wrote: Free advice: whatever you do, don't call @Chris a walrus! Yeah... I do have quite a moustache, but it doesn't merit a high title like that! :) It's the tusks I'd

Re: Find word by given characters

2020-11-02 Thread dn via Python-list
a), and ask various colleagues 'here' to repeat the speed/performance comparisons on other machines. Will/should the results be identical? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Find word by given characters

2020-11-02 Thread dn via Python-list
goals. You cast yourself as 'the learner', but if you (whenever) contribute something along these lines, there will be many who learn from you... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Find word by given characters

2020-11-02 Thread dn via Python-list
olution, alongside an embedded function alternative. (cf anything involving Counter) - but hey, "the more the merrier..."! Performing this sort of experiment, and making such an observation (for oneself) is a great motivator (should one be needed) to learn Python's built-in functions, what is available in the PSL, and locating other similar 'riches' offered within the Python 'eco-system'! -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Find word by given characters

2020-11-03 Thread dn via Python-list
he edX platform - but not in Python. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: songbird's ngfp

2020-11-05 Thread flaskee via Python-list
: (python 3.7 | debian 10.6 | venv) But, it could be me. I'll try it again. I look forward to seeing your game. Thanks! -- https://mail.python.org/mailman/listinfo/python-list

Re: returning totals in functions of math

2020-11-08 Thread dn via Python-list
- https://mail.python.org/mailman/listinfo/python-list

Re: returning totals in functions of math

2020-11-08 Thread dn via Python-list
ve, consider refactoring to use sum()... Web.Refs: https://docs.python.org/3/library/functions.html https://riptutorial.com/python/example/28509/mutable-and-immutable-as-arguments -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: returning totals in functions of math

2020-11-08 Thread dn via Python-list
<<encouraged to join, as are folks interested in helping others learn>>> https://mail.python.org/mailman/listinfo/tutor -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: How can I make this more complex?

2020-11-09 Thread dn via Python-list
# no point in continuing to loop # otherwise continue looping Not to be recommended - but if you are a 'glutton for punishment', don't bother with the dictionary's 0/last entry. Instead use a for-else structure... Such would be an excellent case-study illustration of why 'simple' beats 'complex'! (sorry for the sardonic humor, disregard the last paragraph - most professional coders (in fact, all that I know) eschew for-else, or-else!) -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Need help in installing numpy

2020-11-11 Thread adelamsaleh--- via Python-list
The term 'pip' is not recognized as the name of a cmd let ... etc. I thought that pip is now a part of later versions of python versions 3.x. If so, what did I do wrong? I know this is a very elementary question for this site, but I would appreciate any help. Thanks, -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem with rearanging list with paired letters next to each others

2020-11-11 Thread dn via Python-list
-length-encoding/ -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Class Definitions

2020-11-12 Thread dn via Python-list
g/3/library/collections.html#counter-objects -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Dispatch table of methods with various return value types

2020-11-17 Thread dn via Python-list
the add and whatever happens after that; and the delete, likewise. Otherwise the code must first decide which action-handler, and later, which result-handler - but aren't they effectively the same decision? Thus, is the reporting integral to the get (even if they are in separate routines)? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Dispatch table of methods with various return value types

2020-11-17 Thread dn via Python-list
e follow-throughs, eg ... elif action in [ add, delete, update] report success/fail ... because, at first glance, the second 'ladder' appears to be quite dissimilar - is a different length, doesn't have the condition-clause symmetry of the first, etc! So, our fictional maintainer can ignore the second, correct??? Consider SRP again, and add DRY: should the "despatch" decision be made once, or twice, or... ? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Dispatch table of methods with various return value types

2020-11-19 Thread dn via Python-list
#x27;collect' related functionality and keep it 'together'! Another aspect, following-on from UI comments (above). If you are using a framework, the presentation code will largely fit within those objects. Therefore, logically-separate from manipulating the source-object. Another consideration (maybe) for how to structure and relate the routines... As a general rule, I keep print() out of functions which 'calculate' - even, out of the Person class. This facilitates re-use, where the next use may want to present the results differently, or merely to use the calculation as 'input' and not present 'it' at all! Thanks again for the input! It is good that you are reviewing your code and considering alternate approaches! Many others 'here' will have benefited from considering your points/questions... You may like to pass some information about the Free University: - is Python the primary teaching language - is Python widely used within various schools/departments - is instruction in English, or... - what does "Free" mean - is it also $free - is it open to (non-German) foreigners Tschüss! -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Environment vars

2020-11-25 Thread dn via Python-list
n, but there are caveats. Alternately, did you mean that the above is part of a data-file? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Environment vars

2020-11-25 Thread dn via Python-list
ination/mix of characters - until after you've entered your [ignorant] choice - twice. Grrr! -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: unable to use numpy

2020-11-25 Thread dn via Python-list
giving a suitable solution of this. Please copy-paste the actual commands being used and error messages reported. OpSys? Source of Python? Source of numpy? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Environment vars

2020-11-25 Thread dn via Python-list
On 26/11/2020 08:43, Chris Angelico wrote: On Thu, Nov 26, 2020 at 6:19 AM dn via Python-list wrote: I've got a program which accepts an optional env variable listing a single or multiple directory for the app to use. I've done a bit of a search and see both a comma and semicolon

Re: Environment vars

2020-11-25 Thread dn via Python-list
mail.python.org/mailman/listinfo/python-list

Re: Environment vars

2020-11-27 Thread dn via Python-list
o_me/ -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: A problem with opening a file

2020-11-29 Thread dn via Python-list
he code. Is an open() function defined somewhere? (which will "shadow" the built-in function) That said the description doesn't quite match. Please copy-paste the exact error messages because there's likely missing information... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: A problem with opening a file -- again

2020-11-29 Thread dn via Python-list
, and enter into the REPL: trc = open( 'nap1.log', 'a' ) trc -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Bot

2020-12-01 Thread dn via Python-list
il.python.org/mailman/listinfo/python-list

Re: Fw: See example

2020-12-04 Thread dn via Python-list
'python' is not defined Try the two commands from the command-line (rather than from within the Python interpreter/REPL). -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Error

2020-12-06 Thread dn via Python-list
On 06/12/2020 07:41, Barry Fitzgerald via Python-list wrote: Good day," I purchased a book for my son and followed the directions to a T. (Coding Games in Python) Whenever I got to the point of of moving the "hello" file over to pgzrun is where my trouble began. Its not finding

Re: Letter replacer - suggestions?

2020-12-07 Thread dn via Python-list
le ) Trust this adds to your 'adventures' in learning Python! Web.Refs: https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str https://www.askpython.com/python/string/python-string-translate -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Letter replacer - suggestions?

2020-12-07 Thread dn via Python-list
On 08/12/2020 12:15, Marco Sulla wrote: On Tue, 8 Dec 2020 at 00:10, dn via Python-list wrote: The translation phase is most easily achieved with the built-in str.translate() I forgot it :-) That's down to the rich-ness of the Python eco-system! IIRC (from previous posts) the

Re: Property type hints?

2020-12-09 Thread dn via Python-list
e does not enforce function and variable type annotations. They can be used by third party tools such as type checkers, IDEs, linters, etc. >>> which may stump whatever the aim in using get-type-hints() may have been. If we're only talking about code-review, then (personal) comment of 'documenting' the method-definition applies. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Property type hints?

2020-12-09 Thread dn via Python-list
lass-attributes will become (actually be 'hidden' by) instance-attributes if used on the LHS of an expression within the class (replicating the 'two' entity problem, discussed earlier). -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Planet Python

2020-12-11 Thread dn via Python-list
Has something happened to the Planet Python feed? - Last update: December 07, 2020 04:48 PM UTC -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Function returns old value

2020-12-11 Thread dn via Python-list
e. Code: https://bpa.st/KVGA How this functions should look properly? In the event of "yes" the function returns a value (return ask). When the function calls itself, what happens to the return-ed value? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Function returns old value

2020-12-11 Thread dn via Python-list
ment tab-stops as eight-spaces apart. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Function returns old value

2020-12-11 Thread dn via Python-list
On 12/12/2020 15:25, Chris Angelico wrote: On Sat, Dec 12, 2020 at 1:23 PM dn via Python-list wrote: Speaking personally, I prefer the code to be included in the email. However, it would be better to use spaces rather than tabs (Python's preferred style, per PEP-8) because many email pac

Re: Returning from a multiple stacked call at once

2020-12-12 Thread dn via Python-list
ck", we are looking at a "queue" (per @Cameron). Thus, a "stack" accepts additions to 'the end', and "pops" data from the same 'end' ("LIFO" = last-in, first-out). Whereas a "queue" also adds to 'the end', but processes/pops from the beginning ("FIFO" = first-in, first-out). If this ComSc-stuff is 'new', then plenty of books and web-sites discuss such data-structures... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Planet Python

2020-12-14 Thread dn via Python-list
On 12/12/2020 07:22, dn via Python-list wrote: Has something happened to the Planet Python feed? - Last update: December 07, 2020 04:48 PM UTC Fixed! (Thanks!) Although, still reported as an 'open' issue https://github.com/python/planet/issues/446 -- Regards =dn -- https://mail.

Re: dict.get(key, default) evaluates default even if key exists

2020-12-15 Thread dn via Python-list
> On Tue, Dec 15, 2020 at 9:57 AM Mark Polesky via Python-list < > python-list@python.org> wrote: > >> Hi. >> >> # Running this script >> >> D = {'a':1} >> def get_default(): >> print('Nobody expects this') &

Re: dict.get(key, default) evaluates default even if key exists

2020-12-15 Thread dn via Python-list
unction? Other than personal-preference (which should be respected), and a uniform default-value, what is the rationale for defaultdict over dict.get()? -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Function returns old value

2020-12-16 Thread dn via Python-list
r that in this case their links expire/the bin 'disappears'. After expiry, any posts 'here' with links to 'there', will be useless. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Function returns old value

2020-12-16 Thread dn via Python-list
m as advice from folk who have been 'here' and/or using Python for some time. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

"Worst bugs" and Python?

2020-12-18 Thread dn via Python-list
r to read the entire report. The good news is, that of the six languages headlined in the summaries, Python comes-off 'best' (cf .Net, C++, Java, JavaScript, and PHP). -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: How do you find what exceptions a class can throw?

2020-12-20 Thread dn via Python-list
). Async handles with timeouts implicitly. Apologies for the lack of direct-answer. That's as far as my reading has taken me. Hopefully someone, more in-the-know, will be able to advise... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Installing Python (2.7) 'by hand' on Ubuntu - possible?

2020-12-22 Thread Mirko via Python-list
the required libraries somewhere and set LD_LIBRARY_PATH or maybe LD_PRELOAD accordingly. For a few depending libs, this works well, but it gets really nasty if glibc or big frameworks such as GTK are involved. -- https://mail.python.org/mailman/listinfo/python-list

Re: using regex for password validation

2020-12-23 Thread dn via Python-list
used for UX output and a RegEx? Second UX-consideration (and its a 'biggie'!): if a password 'fails', how can we take the 'result' from a large and complex RegEx, and explain to the user which [multiple] of the five requirements was/were not met? A failure in the RegEx above tells the system not to proceed, but doesn't tell the user is a letter is missing, a digit, ... RegEx is extremely powerful, but 'power' is seductive - just because we can do something doesn't make it a good idea! The Spiderman rule applies... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: using regex for password validation

2020-12-23 Thread dn via Python-list
On 24/12/2020 12:20, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2020-12-24 at 11:41:15 +1300, dn via Python-list wrote: On 24/12/2020 06:03, Sadaka Technology wrote: hello guys, I have this pattern for password validation (regex): [...] Is it my imagination, or does a password in

Re: using regex for password validation

2020-12-23 Thread dn via Python-list
On 24/12/2020 12:25, Chris Angelico wrote: On Thu, Dec 24, 2020 at 9:42 AM dn via Python-list wrote: Hang-on though, look at how much 'work' is involved, compared with a single line of RegEx! Why go to such bother? There's several reasons. Good question! Look at this al

Re: Which method to check if string index is queal to character.

2020-12-28 Thread dn via Python-list
dot/period/stop, then it seems quite probable that our user has made a typo! This is why some sites require an email address to be entered twice. (but copy-paste anyone?) Going much further than a typo-reducing/sanity-check is, per @Richard, considerably harder - and ultimately cannot guarantee an address. Thus, indulges in a sub-field of cyber-alchemy! -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Plotting in python for Monte Carlo Method

2021-01-02 Thread dn via Python-list
nd trainers' use. Contrarily, if you are looking for someone to write code for you, then there are likely many 'here' who will be happy to quote an hourly-rate. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Mauritius Usergroup - End of Year report 2020

2021-01-02 Thread dn via Python-list
On 1/3/21 5:01 PM, Abdur-Rahmaan Janhangeer wrote: > Greetings list, > > Here's our usergroup's end of year report for 2020: > Happy reading! > > https://www.pymug.com/assets/pymug_end_of_year_2020_v2.pdf Well done @A-R! -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

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

2021-01-05 Thread dn via Python-list
each day. In both cases, arithmetic comparison-logic is possible, and library routines exist to format various reporting-formats. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: primitive password cracker

2021-01-07 Thread dn via Python-list
_list ) ) print( one_character_list, end="\n" ) # taking the letters two at a time two_character_list = permute_lists( one_character_list, letters ) print( len( two_character_list ), len( one_character_list ) * len( letters ) ) print( two_character_list, end="\n" ) # taking the letters three at a time three_character_list = permute_lists( two_character_list, letters ) print( len( three_character_list ), len( two_character_list ) * len( letters ) ) print( three_character_list, end="\n" ) -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

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

2021-01-11 Thread dn via Python-list
. Thus, I recommend (free or $) MOOCs on the edX or Coursera platforms (amongst others). As you say, the profession has 'moved on' and there are fresh approaches and new angles to get one's head around... So, it's not just "Python" then! PS you will likely find the Python-Tutor mailing list solid assistance. -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: on writing a number as 2^s * q, where q is odd

2023-11-29 Thread jak via Python-list
Dom Grigonis ha scritto: def powers_of_2_in(n): s = 0 while n % 2 == 0: s += 1 n = n // 2 return s, n Good solution, unfortunately if the input data is zero, the function never ends. On 30 Nov 2023, at 02:44, Julieta Shem via Python-list wrote: How would

Re: on writing a number as 2^s * q, where q is odd

2023-12-03 Thread jak via Python-list
ut here---end--->8--- for n = 0 your function get stack overflow -- https://mail.python.org/mailman/listinfo/python-list

Re: on writing a number as 2^s * q, where q is odd

2023-12-03 Thread jak via Python-list
--end--->8--- for n = 0 your function get stack overflow That's right. Let's say ``assert n > 0'' before we say ``if''. ...or just: ... if n == 0 or remainder(n, 2) != 0: ... -- https://mail.python.org/mailman/listinfo/python-list

Re: on writing a number as 2^s * q, where q is odd

2023-12-04 Thread jak via Python-list
Oscar Benjamin ha scritto: On Sun, 3 Dec 2023 at 10:25, Julieta Shem via Python-list wrote: Alan Bawden writes: def powers_of_2_in(n): bc = (n ^ (n - 1)).bit_count() - 1 return bc, n >> bc That's pretty fancy and likely the fastest. It might be the fastest but it

Re: on writing a number as 2^s * q, where q is odd

2023-12-05 Thread jak via Python-list
+ ((n & 0o070707070707070707070) >> 3)) return (n % 63) + (0, 1, 1, 2)[lt] n=0x bit_count_64(n) 64 n=0x3ffe bit_count_64(n) 61 bit_count_64(1 << 63) 1 ...in C it would have been simpler :^) -- https://mail.python.org/mailman/listinfo/python-list

Re: How/where to store calibration values - written by program A, read by program B

2023-12-05 Thread MRAB via Python-list
On 2023-12-05 14:37, Chris Green via Python-list wrote: Is there a neat, pythonic way to store values which are 'sometimes' changed? My particular case at the moment is calibration values for ADC inputs which are set by running a calibration program and used by lots of programs whi

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread MRAB via Python-list
On 2023-12-06 12:23, Thomas Passin via Python-list wrote: On 12/6/2023 6:35 AM, Barry Scott via Python-list wrote: On 6 Dec 2023, at 09:32, Chris Green via Python-list wrote: My requirement is *slightly* more complex than just key value pairs, it has one level of hierarchy, e.g

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread dn via Python-list
On 7/12/23 07:12, MRAB via Python-list wrote: On 2023-12-06 12:23, Thomas Passin via Python-list wrote: On 12/6/2023 6:35 AM, Barry Scott via Python-list wrote: On 6 Dec 2023, at 09:32, Chris Green via Python-list wrote: My requirement is *slightly* more complex than just key value pairs

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread MRAB via Python-list
On 2023-12-06 20:11, dn via Python-list wrote: On 7/12/23 07:12, MRAB via Python-list wrote: On 2023-12-06 12:23, Thomas Passin via Python-list wrote: On 12/6/2023 6:35 AM, Barry Scott via Python-list wrote: On 6 Dec 2023, at 09:32, Chris Green via Python-list wrote: My requirement is

Re: A problem with str VS int.

2023-12-09 Thread dn via Python-list
On 10/12/23 15:42, Steve GS via Python-list wrote: If I enter a one-digit input or a three-digit number, the code works but if I enter a two digit number, the if statement fails and the else condition prevails. tsReading = input(" Enter the " + Brand + " tes

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread MRAB via Python-list
On 2023-12-11 15:57, Chris Green via Python-list wrote: Chris Green wrote: Is there a way to abbreviate the following code somehow? lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'} sv = {'dev':'bbb'

Re: A problem with str VS int.

2023-12-12 Thread dn via Python-list
ghlight=sort -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: IDLE editor suggestion.

2023-12-12 Thread MRAB via Python-list
On 2023-12-12 08:22, Steve GS via Python-list wrote: Maybe this already exists but I have never seen it in any editor that I have used. It would be nice to have a pull-down text box that lists all of the searches I have used during this session. It would make editing a lot easier if I could

Re: IDLE editor suggestion.

2023-12-12 Thread MRAB via Python-list
On 2023-12-13 01:28, Steve GS via Python-list wrote: Does anything from the Visual Studio family of software have a pull down menu that lists previous searches so that I don’t have to enter them every time? SGA Visual Studio search box has a dropdown list that's shown when you press the

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

2023-12-22 Thread Barry via Python-list
> On 22 Dec 2023, at 12:39, Sibylle Koczian via Python-list > wrote: > > Hello, > > I always install Python on Windows in the same manner: > > - Python is not on the path, > - it is installed for all users, > - the Python Launcher is installed for all users

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

2023-12-22 Thread Barry via Python-list
> On 22 Dec 2023, at 14:29, Sibylle Koczian wrote: > > #!/usr/bin/env/python That was what i thought you had and it will not work. The BOM suggestion is worth trying. Barry -- 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-22 Thread Barry via Python-list
> On 22 Dec 2023, at 14:58, Christian Buhtz via Python-list > wrote: > > On Windows 11 it usually is the "Terminal" which is different from cmd.exe. In terminal app you can run cmd.exe or powershell, so it is basically the same. Barry -- https://mail.python.org/m

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

2023-12-22 Thread Barry via Python-list
> On 23 Dec 2023, at 00:15, Thomas Passin via Python-list > wrote: > > In neither case is the shebang line used. As i understand it, not in front of my windows box to check. The handler for .py file extension is set to be the py.exe It is py.exe that understands shebang l

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

2023-12-23 Thread rbowman via Python-list
work with virtualenv or conda? I'm slowly getting up to speed with those. -- https://mail.python.org/mailman/listinfo/python-list

Re: making your own DirEntry.

2023-12-23 Thread immibis via Python-list
On 12/23/23 10:48, Antoon Pardon wrote: Op 22/12/2023 om 21:39 schreef DL Neil via Python-list: Why create a DirEntry? Why not go directly to os.mkdir() or whatever? Because I have functions with DirEntry parameters. Python is duck-typed, so it's quite likely that if you pass some

Re: What is Install-Paths-To in WHEEL file?

2023-12-24 Thread Barry via Python-list
> On 24 Dec 2023, at 00:58, Left Right via Python-list > wrote: > > I'm trying to understand the contents of Wheel files There are lots of packaging experts that hang out on https://discuss.python.org/ you are likely to get a response there if not here replies.

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

2023-12-24 Thread Barry via Python-list
> On 24 Dec 2023, at 00:54, rbowman via Python-list > wrote: > > Does that work with virtualenv or conda? I'm slowly getting up to speed > with those. Conda is its own thing, not need for py.exe. Once you have created the venv you do not need py.exe as you will have py

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

2023-12-25 Thread rbowman via Python-list
On Sun, 24 Dec 2023 22:55:34 +, Barry wrote: >> On 24 Dec 2023, at 00:54, rbowman via Python-list >> wrote: >> >> Does that work with virtualenv or conda? I'm slowly getting up to speed >> with those. > > Conda is its own thing, not need for py.exe

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread MRAB via Python-list
On 2023-12-25 19:53, Alan Gauld via Python-list wrote: On 25/12/2023 05:34, geetanajali homes via Python-list wrote: import numpy as np import pandas as pd import random import matplotlib.pyplot as plt %matplotlib inline I get an error on the last line. I am running this code in Idle

Re: How/where to store calibration values - written by program A, read by program B

2023-12-28 Thread rbowman via Python-list
sume the changes will be picked up when the scripts are restarted but this is not always acceptable. -- https://mail.python.org/mailman/listinfo/python-list

Re: mypy question

2023-12-30 Thread Barry via Python-list
> On 30 Dec 2023, at 15:11, Karsten Hilbert via Python-list > wrote: > > queries = [{'SQL': 'SELECT %(value)s', 'args': {'value': 1}}] > > and > > run_queries(conn, queries:list[str|dict[str, Any]]): In cases like this I o

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

2024-01-01 Thread Barry via Python-list
> On 1 Jan 2024, at 11:14, Sibylle Koczian via Python-list > wrote: > > But in all this thread I didn't see a single explanation for my current > situation: one and the same shebang line works on Windows 10 / Python 3.11 > and doesn't work on Windows 11 / Py

Re: Extract lines from file, add to new files

2024-01-11 Thread MRAB via Python-list
On 2024-01-11 18:08, Rich Shepard via Python-list wrote: It's been several years since I've needed to write a python script so I'm asking for advice to get me started with a brief script to separate names and email addresses in one file into two separate files: salutation.txt and

Re: Extract lines from file, add to new files

2024-01-11 Thread Mirko via Python-list
Am 11.01.24 um 20:53 schrieb Rich Shepard via Python-list: On Thu, 11 Jan 2024, Piergiorgio Sartor via Python-list wrote: Why not to use bash script for all? Piergiorgio, That's certainly a possibility, and may well be better than python for this task. Thank you, Rich awk '

<    5   6   7   8   9   10   11   12   13   14   >