Re: About float/double type number in range.

2020-08-26 Thread dn via Python-list
t;*"*12 ) try: for fp_number in fp_iter( 3, 1, 0.5 ): print( fp_number ) except OverflowError as e: print( e ) <<< Console.out >>> 1 1.5 2.0 2.5 1 1.25 1.5 1.75 2.0 2.25 2.5 2.75 1 1.5 2.0 2.5 1 1.25 1.5 1.75 2.0 2.25 2.5 2.75 RangeError: start must be less than stop -- Regards =dn -- https://mail.python.org/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
, and then identifying d2 as datetime.datetime.now() instead. These questions befuddle the mind when first presented, yet the answer seems so logical once it becomes hindsight... Evidence:- (blank lines added for readability) dn $ ... python3 Python 3.8.5 (default, Aug 12 2020, 00:00:00) [

Re: File Name issue

2020-10-18 Thread dn via Python-list
t call last): File "./test.py", line 4, in for line in infile: File "/usr/lib/python3.8/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte

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
7;Requires improvement'}, u'reportDate': u'2016-06-11', u'reportLinkId': u'0cc4226b-401e-4f0f-ba35-062cbadffa8f'}, {u'overall': {u'keyQuestionRatings': [{u'name': u'Safe', u'rating': u'Good'}

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

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

2020-10-30 Thread dn via Python-list
.. print( f"No! { x } <= 1.5" ) ... Yes! 3 Documented in the manual at https://docs.python.org/3/reference/expressions.html?highlight=walrus#assignment-expressions Read more at https://www.python.org/dev/peps/pep-0572/ Free advice: whatever you do, don't call @Chris a walrus! -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

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
On 03/11/2020 12:10, Bischoop wrote: On 2020-11-02, dn wrote: If you have a working Py2 version, once print-statements were changed into functions, what errors were thrown-up? That was almost 15 if no more years ago when I was learning then had a long break beacause Life :-) Got married

Re: Find word by given characters

2020-11-02 Thread dn via Python-list
On 03/11/2020 13:13, duncan smith wrote: On 02/11/2020 19:09, dn wrote: On 02/11/2020 23:29, Bischoop wrote: On 2020-11-01, duncan smith wrote: But this generates the letters counts for each word. They only need to be generated once (outside the for loop). And using count requires iterating

Re: Find word by given characters

2020-11-03 Thread dn via Python-list
ourses and other U.Mich offerings are available from https://www.coursera.org/search?query=python&; (624 'hits'!). You will find similar (perhaps I notice a DataScience/ML bias?) on edx.org (https://www.edx.org/search?q=python&tab=course) Your thoughts? Disclaimer: I train from t

Re: returning totals in functions of math

2020-11-08 Thread dn via Python-list
on what a better number might be for the total to equal? Fair comment - arguments discussed in previous post - try what has been suggested... The "Law of Identity" is that zero added to anything doesn't change the value, eg 1 + 0 = 1; 1 million + 0 = 1 million... -- Regards =dn -

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

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
. These look very similar to your student's submission. One of their objectives is to cut-through a load of the boiler-plate - in many circumstances. https://www.python.org/dev/peps/pep-0557/ https://docs.python.org/3/library/dataclasses.html See also Counter Objects: https://docs.python.or

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
On 17/11/2020 23:35, Loris Bennett wrote: dn writes: On 17/11/2020 22:01, Loris Bennett wrote: Hi, I have a method for manipulating the membership of groups such as: def execute(self, operation, users, group): """ Perform the given operation on

Re: Dispatch table of methods with various return value types

2020-11-19 Thread dn via Python-list
On 19/11/2020 02:13, Loris Bennett wrote: dn writes: Firsty, thanks for taking the time to write such a detailed reply. Bitte! I have a method for manipulating the membership of groups such as: def execute(self, operation, users, group): """ Pe

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
ice is to enable either/both! (hint: str.translate() ) Conversely, consider the level of frustration faced by a user who expects one thing but is *restricted* to something else, eg sites which ask one to register a password, but don't advise up-front that they require some arcane comb

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
Ahha! Didn't know about os.pathsep. Seems simple enough to use that and be done with it. I'm just using str.split() just now. Is there a os.splitpath()? I don't see anything in the docs. https://docs.python.org/3/library/os.path.html#os.path.split -- Regards =dn -- https://

Re: Environment vars

2020-11-27 Thread dn via Python-list
ot believe that "confession is good for the soul"! It's always DNS, especially when a sysadmin makes a hash of their semicolons Remember the days when 'we made it up as we went along'? Richard Speed Mon 23 Nov 2020 // 08:15 UTC https://www.theregister.com/2020/11/23/wh

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
27;t waste time "camping" the website. Thank you https://duckduckgo.com/?q=python+web+form+fill - the third or fourth response seemed to handle a log-on screen. Although if you're prepared to pay for their time, others may be able to save your time... -- Regards =dn -- https://ma

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
Yes I selected all users and the variables options on custom install. Any Suggestions? It would help to have some detail: OpSys, source of Python and pygame, editor/IDE in-use, how executing pygame zero, etc. - please copy-paste relevant code and/or error messages. else: https://d

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
won't hazard a guess at the minds of the 'Python gods' who design and implement these things. However, please remember that in this discussion we have been using Python itself, whereas the docs and PEP-justifications for typing clearly say: <<< Note The Python runtim

Re: Property type hints?

2020-12-09 Thread dn via Python-list
On 10/12/2020 13:06, Paul Bryan wrote: Thanks for the comprehensive response, dn! I guess I'm influenced by data classes here, where the object's attribute type hints are represented by class variable annotations. I'm a great fan of them too - the saving of 'boilerplat

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
On 12/12/2020 15:09, Bischoop wrote: On 2020-12-12, dn wrote: On 12/12/2020 14:25, Bischoop wrote: I've function asking question and comparing it, if is not matching 'yes' it does call itself to ask question again. The problem is that when function is called second time

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
a default *value* and not used a function in there to provide said value. That said, the function's name says it all: get_default(). Is it 'getting' a default value? No, it's (also) reporting-back. Thus a "side-effect". Undesirable, as you say. Were it appropria

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
On 17/12/2020 16:06, Bischoop wrote: On 2020-12-17, dn wrote: Remember that posts to the list are archived, and thus may be searched. People experiencing similar problems in-future will be able to 'mine' the archives for help and advice. Using a/any pastebin is great for immedia

"Worst bugs" and Python?

2020-12-18 Thread dn via Python-list
ft and Oracle (plus, plus, ...) do not allow just-anyone to analyse their source-code - whereas 'open source' is available for analysis, by definition! An easy 'target' for shallow analysis? At this point I gave up, lacking the interest to fill-out the contact-form, o

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: 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: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread dn via Python-list
ingest a large browser bookmarks JSON file. It wouldn't matter for a much smaller file, of course. It would be safer if you used literal_eval. Ah, memories of Python2... Does this little hack still work? What about True/False cf true/false? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: A problem with str VS int.

2023-12-09 Thread dn via Python-list
ereafter...). "But wait, there's more!" (assuming implement as-above): if 0 <= ts_reading < 400: 1 consistent 'direction' of the comparisons = readability 2 able to "chain" the comparisons = convenience 3 identifier is PEP-008-compliant = quality and style -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: A problem with str VS int.

2023-12-12 Thread dn via Python-list
those three steps, if there's something that's still mystifying, please refine the question... Web.Refs: https://en.wikipedia.org/wiki/Collation https://docs.python.org/3/reference/expressions.html?highlight=comparison#value-comparisons https://docs.python.org/3/howto/sorting.html?hi

Re: Extract lines from file, add to new files

2024-01-11 Thread dn via Python-list
it is bounding-parentheses which define). In this case, the issue is 'connecting' the context-manager "expression" with its (as) "target". These should be more-closely paired:- with ( open( 'example.txt', 'r', ) as e, open( 'emails.txt', 'w', ) as m, open( 'salutations.txt', 'w', ) as s ): (NB code not executed here) A data-architecture of having related-data in separated serial-files is NOT recommendable! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-11 Thread dn via Python-list
s a rude comment about wiping noses - but probably a step too far wrt the CoC) -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-13 Thread dn via Python-list
into a MongoDB or RDBMS. ** code """ PythonExperiments:rich.py Demonstrate string extraction. """ __author__ = "dn, IT&T Consultant" __python__ = "3.12" __created__ = "PyCharm, 14 Jan 2024" __copyright__ = "Copyright © 2024~" __licens

Mtg: Object-Oriented VacExcHndlrs (UTC+13)

2024-01-13 Thread dn via Python-list
insert your question here: What do you want to know? What has been bothering you about OOP (or O-O in Python) that you'd like to settle? To join us (we don't bite!), please RSVP at https://www.meetup.com/nzpug-auckland/events/298536620/ -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-13 Thread dn via Python-list
e lines) Similarly, many dev.teams have a 'standard' which suggests that once a function/method has three or more arguments, relative-positioning should go out-the-window, in favor of named-arguments. This speeds comprehension and reduces errors. In the original mental-model, the difficulty was which file-descriptor would be paired with which file (previously described). The multiple as-s make it more readable and more comprehensible. Since it looks like you are doing this for educational reasons, I think there's a tiny bit of value to my effort. That's what we're (all) here for! (and not forgetting that the OP described a skill-level well below that of most of this post and your question, which enabled (and deserved, IMHO) appropriate respect). -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-14 Thread dn via Python-list
On 14/01/24 16:48, Chris Angelico wrote: On Sun, 14 Jan 2024 at 14:43, dn via Python-list wrote: Similarly, whilst we could write: a, b, c = 1, 2, 3 I would only do this when it aligns particularly well with the algorithm being implemented. For example, you could start a Fibonacci

Re: Extract lines from file, add to new files

2024-01-14 Thread dn via Python-list
d Python's structure to some golden-ideal? Web.Refs: https://docs.python.org/3/reference/compound_stmts.html#the-for-statement https://docs.python.org/3/reference/simple_stmts.html#grammar-token-python-grammar-target_list https://docs.python.org/3/reference/compound_stmts.html#function-definitions -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-14 Thread dn via Python-list
) Admittedly, a #-comment does not qualify as an object; but then the hash is an exclusion signal, which the lexer understands as ending the logical line. Thus, a comment has meaning at 'compile time', but not at 'execution time'. Such would be true, strictly-speaking. However, most of us would say that a comment 'has no meaning' in terms of the parser, and what it delivers. Shall we change the phrase to "everything in Python, at run-time, is an object"? As a phrase it is obiter-dictum, not ratio decidendi! (to use a language which has only extended in dubious modes for the last couple-of-thousand years - but which still has illogical structure) Suspect that clumsy exclusion also lacks precision to the standard being demanded. Thus return to the suggestion that you seem in the wrong place, because Python doesn't meet the required standard. Sorry! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-14 Thread dn via Python-list
ith the 'walrus-operator'? PS our interlocutor doesn't like colloquialisms such as these - despite them being near-and-dear to our hearts! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-01-14 Thread dn via Python-list
On 15/01/24 11:47, Chris Angelico via Python-list wrote: On Mon, 15 Jan 2024 at 09:40, dn via Python-list wrote: The basic challenge came from my earlier (and blasé) repetition of the Python refrain "everything in Python is an object". Which led to: ... So, no, there's an &qu

Re: Extract lines from file, add to new files

2024-01-14 Thread dn via Python-list
On 15/01/24 14:33, Chris Angelico via Python-list wrote: On Mon, 15 Jan 2024 at 12:12, dn via Python-list wrote: Here's another witticism I'll often toss at trainees (in many languages, and especially in UX): just because we can do it, doesn't make it a good idea! Programm

Re: Extract lines from file, add to new files

2024-01-14 Thread dn via Python-list
On 15/01/24 14:45, Chris Angelico wrote: On Mon, 15 Jan 2024 at 12:42, dn via Python-list wrote: On 15/01/24 14:33, Chris Angelico via Python-list wrote: On Mon, 15 Jan 2024 at 12:12, dn via Python-list wrote: Here's another witticism I'll often toss at trainees (in many lang

Re: Extract lines from file, add to new files

2024-01-15 Thread dn via Python-list
On 15/01/24 21:13, Greg Ewing via Python-list wrote: On 15/01/24 1:54 pm, dn wrote: Soon after, Wirth simplified rather than expanded, and developed Pascal. Before Pascal there was Algol-W, which Wirth invented as a rebellion against how complicated Algol 68 was becoming. When I first saw

Re: Extract lines from file, add to new files

2024-01-29 Thread dn via Python-list
surprised to see them discussed in 'modern' texts. However, the principle is: read a record from each file, do-the-business, read the next 'pair' of physically-related records, rinse-and-repeat. If you require further assistance: how about showing a couple of relevant lines of t

MTG: pytest (NZPUG, Auckland, VacExcHndlrs)

2024-01-31 Thread dn via Python-list
g - CI/CD chaining you've built - plug-ins you're finding helpful - coverage - testing strategies - other testing frameworks and aids (open-ended - what would you like to add?) Come to participate, learn-from, and help others! Please RSVP at https://www.meetup.com/nzpug-auckland/events/29

Re: Extract lines from file, add to new files

2024-02-03 Thread dn via Python-list
) Whether we (here) are talking about 'poor' manners, 'poor' understanding, 'poor' communication skills, 'poor' Python knowledge, or whatever; isn't such one of the rationales for this DiscussionList? That said, we're all volunteering our (valuable) time! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Extract lines from file, add to new files

2024-02-04 Thread dn via Python-list
is going to be productive when communicating with a pedantic compiler? Again, some people are suited to this business (or specific jobs within), and some (?many) are not - but many are (perhaps reluctantly) programming to get some other job done... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: test-ignore

2024-02-15 Thread dn via Python-list
ter's aim was to see if posts to comp.lang.python traverse the gateway and show up on this list, then alt.test won't help. Coincidentally (I hope), today have received a couple of poorly-executed spam/phishing messages purporting to be from this list or "Tutor".

Re: Using __new__

2024-02-17 Thread dn via Python-list
- all failures are silent * noting "Nowadays, the Singleton pattern has become so popular that people may call something a singleton even if it solves just one of the listed problems." (https://refactoring.guru/design-patterns/singleton) YMMV! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Using __new__

2024-02-17 Thread dn via Python-list
n learn from, or contribute to, this conversation! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Using __new__

2024-02-17 Thread dn via Python-list
The earlier comment was that class S( object ): is 'tradition', and synonymous with: class S: (not disputing the concept of "object" as the base class) Not correct. Please see last paragraph from previous message: On Sat, Feb 17, 2024 at 7:06 PM dn via Python-li

Re: Can one output something other than 'nan' for not a number values?

2024-02-18 Thread dn via Python-list
PSL's string library: "Format Specification Mini-Language" https://docs.python.org/3/library/string.html#format-specification-mini-language Has the OP stated if we're talking 'Python' or numpy, pandas, ...? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Testing (sorry)

2024-02-18 Thread dn via Python-list
tor 'holds onto' the earlier message, then how should I/anyone know? * yes, repetition improves learning, slightly different words may help comprehension; but doubt I can express anything better than the aforementioned does/did/can. -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Can one output something other than 'nan' for not a number values?

2024-02-19 Thread dn via Python-list
odule and package (except standard library modules and site-packages) is modified with that function. Final code is here: https://github.com/mivdnber/formathack Some of this (Expression components inside f-strings) newly available in v3.12 (PEP-701) - which can be used in production...

Re: Can one output something other than 'nan' for not a number values?

2024-02-19 Thread dn via Python-list
On 20/02/24 01:04, Chris Green via Python-list wrote: dn wrote: On 18/02/24 09:53, Grant Edwards via Python-list wrote: On 2024-02-17, Cameron Simpson via Python-list wrote: On 16Feb2024 22:12, Chris Green wrote: I'm looking for a simple way to make NaN values output as something

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-05 Thread dn via Python-list
e # end of import snippet Thanks if you have any ideas/thoughts on the matter Jacob Kruger +2782 413 4791 "Resistance is futile!...Acceptance is versatile..." -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Variable scope inside and outside functions - global statement being overridden by assignation unless preceded by reference

2024-03-06 Thread dn via Python-list
lobals() functions. You may also have detected that many of us try to avoid globals and the implicit assumptions about the behavior of mutable collections (eg lists) when treated as 'global'. Then there are "closures", the "LEGB" rule, namespaces, scope, and ... -- -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: A Single Instance of an Object?

2024-03-11 Thread dn via Python-list
be a class-attribute (it is currently an instance. Then, code AFTER the definition of Lookup can refer to Lookup.cache, regardless of instantiation, and code within Lookup can refer to self.cache as-is... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Configuring an object via a dictionary

2024-03-15 Thread dn via Python-list
self.server_port, self.user_base, self.user_identifier, self.group_base, self.group_identifier, self.owner_base = config_access() ) If you know my style/preferences, notice that I'm breaking

Re: Configuring an object via a dictionary

2024-03-16 Thread dn via Python-list
ruthy/falsy was inappropriate, please? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Configuring an object via a dictionary

2024-03-16 Thread dn via Python-list
me is not None or default_value or: self.name = default_value if name is None or name because "is" checks for identity, whereas "==" and True-thy encompass a range of possible alternate values? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

MTG: Introductions to PyQt and DataClasses

2024-03-16 Thread dn via Python-list
irefox - for now). A head-set will facilitate asking questions but text-chat will be available. Please RSVP at https://www.meetup.com/nzpug-auckland/events/299764049/ See you there! =dn, Branch Leader -- https://mail.python.org/mailman/listinfo/python-list

Re: MTG: Introductions to PyQt and DataClasses

2024-03-17 Thread dn via Python-list
On 17/03/24 23:40, Jim Schwartz wrote: Will it be recorded? Better than that (assumption) "coming soon" - please join-up or keep an eye on PySprings' Meetup ANNs: https://www.meetup.com/pysprings/ On Mar 17, 2024, at 1:47 AM, dn via Python-list wrote: The Auckland Branch

Re: Configuring an object via a dictionary

2024-03-17 Thread dn via Python-list
On 18/03/24 04:11, Peter J. Holzer via Python-list wrote: On 2024-03-17 17:15:32 +1300, dn via Python-list wrote: On 17/03/24 12:06, Peter J. Holzer via Python-list wrote: On 2024-03-16 08:15:19 +, Barry via Python-list wrote: On 15 Mar 2024, at 19:51, Thomas Passin via Python-list

Re: MTG: Introductions to PyQt and DataClasses

2024-03-17 Thread dn via Python-list
/should I 'do more', and similar. One of the valuable observations is that most of us would benefit by improving our sleep-schedule and ensuring we do sleep for sufficient time (probably longer than current habit). -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Multiplication

2024-04-01 Thread dn via Python-list
I guess the operator "*" can be imported from any module... :-) bye, -- piergiorgio -- https://mail.python.org/mailman/listinfo/python-list -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: How to Add ANSI Color to User Response

2024-04-10 Thread dn via Python-list
How to print colored terminal text in Python MAR 06, 2024 ... https://byby.dev/py-print-colored-terminal-text -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Data Ethics (Virtual) Meeting

2024-04-10 Thread dn via Python-list
-innovation/ from which you can access their Work Programme and Guidance developed to-date. Please RSVP at https://www.meetup.com/nzpug-auckland/events/299764076/ * hui is the Te Reo Maori word for meeting or conference (Te Reo is one of New Zealand's official languages) -- Regards =dn --

<    1   2   3   4   5   6   >