Re: Struggling to understand Callable type hinting

2025-01-17 Thread dn via Python-list
ase-in gradually - add the easy stuff now, and come back to deal with the rest later (otherwise the typing 'tail' is wagging the coding 'dog'!) -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Tools to help with text mode (i.e. non-GUI) input

2025-01-11 Thread dn via Python-list
ations of packages to do this. Maybe a good place to start is the Python Prompt Toolkit (https://python-prompt-toolkit.readthedocs.io/en/master/) -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Python List is Not Dead

2024-12-26 Thread dn via Python-list
ity. Also, do I need to discuss the way so many people ask for help but give minimum assistance to their hoped-for respondents? https://www.catb.org/~esr/faqs/smart-questions.html ... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: How to go about describing my software with a component diagram?

2024-12-25 Thread dn via Python-list
modules", or something else. -- https://mail.python.org/mailman/listinfo/python-list -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread dn via Python-list
modules inside a larger "Algorithm" shape. -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: How to go about describing my software with a component diagram?

2024-12-24 Thread dn via Python-list
documentation. A tool for including block-graphics in these is "Mermaid" (https://mermaid.js.org/intro/). -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: FileNotFoundError thrown due to file name in file, rather than file itself

2024-11-11 Thread dn via Python-list
n for rough definition of "block") should achieve one thing ("concern"). Thus, the advice to separate-out the file-read and attendant defensive-coding. This anticipates the problem (2) of distinguishing the subject of any one error/stack-trace from any others - and, argua

Re: Two aces up Python's sleeve (Posting On Python-List Prohibited)

2024-11-08 Thread dn via Python-list
> x, y (6, 6) However, if such were submitted for Code Review, unhappiness would result. Was the question re-phrased to: how to ... in Python, we'd end-up with something more like this: >>> x = 5 # define >>> x += 1 # increment >>> y = x # alias >>> x, y (6, 6) -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Two aces up Python's sleeve

2024-11-07 Thread dn via Python-list
= 1; b += 1; c -= 1; d -= 1 ... 0 0 0 0 1 1 -1 -1 2 2 -2 -2 3 3 -3 -3 4 4 -4 -4 5 5 -5 -5 6 6 7 7 8 8 9 9 ... 254 254 255 255 256 256 >>> Be aware that this is implementation-dependent and not guaranteed to hold forever. dn  ~  python Python 3.12.7 (main, Oct 1 2024, 00:0

Re: Two python issues

2024-11-05 Thread dn via Python-list
y... ('nuff said!) With reference to the OP content about slicing: - Python's memory-addressing is different from many other languages. Thus, requires study before comparison/criticism - there are major differences in what can be accomplished with mutable and immutable objects -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: learning Python

2024-10-27 Thread dn via Python-list
. Coursera and edX have many courses. Harvard CS50-P (for Python) may suit... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.8 or later on Debian?

2024-09-18 Thread dn via Python-list
used. Am sure there are plenty of how-to-installs. Here's one: https://bgasparotto.com/install-pyenv-ubuntu-debian Am using pyenv to support multiple projects initially built during the reign of multiple Python versions (which now update annually - next is about two weeks away). -- Regards,

Re: Crash when launching python

2024-09-04 Thread dn via Python-list
ific configuration hook https://docs.python.org/3/library/site.html#module-site Please let us know how things progress... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Formatting a str as a number - Okay, one more related thing...

2024-09-01 Thread dn via Python-list
 456,78 Here's some old code, filched from somewhere (above web.ref?) and updated today to produce the above:- """ PythonExperiments:locale_numbers.py Demonstrate numeric-presentations in different cultures (locales). """ __author__ = "dn, IT&am

ListAdmin: Is list/archive working correctly?

2024-08-30 Thread dn via Python-list
were they ever)? Is it user-error that some contributions don't appear on the list, but do appear in replies, or is there perhaps some other cause? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Script stops running with no error

2024-08-28 Thread dn via Python-list
ou do ask for assistance you will be able to provide only the pertinent code AND some sample input-data with expected-results! (although, if all our dreams come true, you will answer your own question!) OK, is that enough by way of coding-tactics (not to mention the web-research) to keep you on-track for a while? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a better way? [combining f-string, thousands separator, right align]

2024-08-26 Thread dn via Python-list
On 26/08/24 23:00, Dan Sommers via Python-list wrote: On 2024-08-26 at 20:42:32 +1200, dn via Python-list wrote: and if we really want to go over-board: RIGHT_JUSTIFIED = ">" THOUSANDS_SEPARATOR = "," s_format = F"{RIGHT_JUSTIFIED}{S_FIELD_WIDTH}{THOUSANDS_SEPAR

Re: Is there a better way? [combining f-string, thousands separator, right align]

2024-08-26 Thread dn via Python-list
numbers: >>> s_format = F"{S_FIELD_WIDTH}{THOUSANDS_SEPARATOR}" To the extreme that if your user keeps fiddling with presentations (none ever do, do they?), all settings to do with s_format could be added to a config/environment file, and thus be even further separated from program-logic! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: new here

2024-08-25 Thread dn via Python-list
-with-the- pico/2 -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: new here

2024-08-22 Thread dn via Python-list
On 23/08/24 15:43, rbowman via Python-list wrote: On Fri, 23 Aug 2024 08:36:02 +1200, dn wrote: On 23/08/24 07:49, rbowman via Python-list wrote: On Thu, 22 Aug 2024 10:40:52 -0700, Paul Rubin wrote: The Pico uses MicroPython which is stuck on an old version of Python, unfortunately. How

Re: new here

2024-08-22 Thread dn via Python-list
-like-the-clappers! I haven't worked with CircuitPython lately and don't know if it has pulled in later features. Have you (gentle reader) used both and feel able to offer a comparison - when to prefer one over the other? [https://www.phrases.org.uk/meanings/like-the-clappers.html] -- R

Re: new here

2024-08-21 Thread dn via Python-list
ard web-browser, try: https://www.yr.no/en/content/2-4164138/meteogram.svg -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: new here

2024-08-21 Thread dn via Python-list
ution you may be able to offer, and will look forward to hearing of the projects you attempt... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: bring back nntp library to python3

2024-08-14 Thread dn via Python-list
opponents desire! How should a 'community' handle such? How should decisions be made, and then communicated in such a way as to promote and build community, even though some members may be disappointed? Recently there was an election for PSF members. Did 'everyone' partici

Re: Help needed - - running into issues with python and its tools

2024-08-03 Thread dn via Python-list
On 4/08/24 09:34, o1bigtenor via Python-list wrote: On Sat, Aug 3, 2024 at 4:06 PM dn via Python-list wrote: On 4/08/24 08:17, o1bigtenor via Python-list wrote: Greetings Looking at ESP8266 and wanting to program it using micropython (really don't want to have to learn C++ (not enough

Re: Help needed - - running into issues with python and its tools

2024-08-03 Thread dn via Python-list
earning/training will be necessary as pre-requisite to (being able to) attack the project). -- Regards =dn -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Predicting an object over an pretrained model is not working

2024-07-30 Thread dn via Python-list
uming it hasn't) why the dict has not been sorted into a meaningful order 3 how can one tell that the image is more likely to be a sheep than a train? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Best use of "open" context manager

2024-07-06 Thread dn via Python-list
mber that whilst context-managers and generators are distinct concepts within Python, they are quite similar in many ways. So, a custom generator could work like a context-manager or 'wrap' a context-manager per Idea 1. Building a custom-class (Idea 1 or Idea 3) enables

Re: Anonymous email users

2024-06-24 Thread dn via Python-list
ng GMail and MSFT's email services). Python mailing-lists are covered by the Code of Conduct and monitored by ListAdmins. Thus, there are controls which limit the impact which advertisers and others with non-pythonic aims might otherwise exert! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Anonymous email users

2024-06-17 Thread dn via Python-list
oming message is from a list - so easy accident.) The Delete-key is your friend! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Anonymous email users

2024-06-14 Thread dn via Python-list
sting conundrum. There are good reasons and nefarious, for such behavior. Some have questioned my behavior in similar regard - asking why I use initials (also used IRL). It is because my first name "David" is/was very popular. At a meeting this week there were three of us. Thus, "Dav

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-06-04 Thread dn via Python-list
On 31/05/24 14:26, HenHanna via Python-list wrote: On 5/30/2024 2:18 PM, dn wrote: On 31/05/24 08:03, HenHanna via Python-list wrote: Given a text file of a novel (JoyceUlysses.txt) ... could someone give me a pretty fast (and simple) Python program that'd give me a list of all

Re: From JoyceUlysses.txt -- words occurring exactly once

2024-05-30 Thread dn via Python-list
y-rate for this work? Split into words - defined as you will. Use Counter. Show some (of your) code and we'll be happy to critique... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: SOLVED! Re: Weird Stuff (Markdown, syntax highlighting and Python)

2024-05-29 Thread dn via Python-list
may find a similar problem - in the similar manner to the various members who have helped YOU, voluntarily (and despite the paucity of source-information and response)? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Weird Stuff (Markdown, syntax highlighting and Python)

2024-05-27 Thread dn via Python-list
#x27;d hate to spend an additional day or two, hunting for this info. Again, heavily dependent upon the tool in-use. For example, most SSGs and doc-tools (which accept Markdown) have a .css or theming-system which enables 'decorations'. References: https://pypi.org/project/Markdown/

Re: Cprod -- (writing this: itertools.product([0, 1], repeat=N )

2024-05-21 Thread dn via Python-list
ays to improve it? https://python.readthedocs.io/en/stable/library/itertools.html#itertools.product -- 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 --

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

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

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

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

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

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

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

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

NZPUG Mtg: Making Python faster, and "Dependency Inversion"

2023-11-22 Thread dn via Python-list
ctive advice, suggestions, and alternate approaches will be valued ... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Newline (NuBe Question)

2023-11-15 Thread dn via Python-list
es all mashed together? Yes, what changed after removal of all the .append()-s, and instead, within the (second) for-loop print( school, name, ... ) was used? Is it easier to go on from there? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Clearing the Deque • Picturing Python’s `deque` data structure

2023-11-07 Thread dn via Python-list
NZPUG Auckland Branch): https://www.meetup.com/nzpug-auckland/events/295433874/ -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread dn via Python-list
at does mean? Is there a change from python2 to python3? Works for me (Python 3.11 on Fedora-Linux 37) - both as a script, and simple/single import. What happens when you extract the second dimension's definitions into a module of their own, and import that (with/out less-sophisticated join)

Safe package removal

2023-11-05 Thread dn via Python-list
n-installer, or if something, somewhere, will 'break'? (yes, there's an upgrade to Fedora 38 in "The Backlog") -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Checking if email is valid

2023-11-02 Thread dn via Python-list
bout "closeness". Thus, what you might expect from email servers and Admins, NOT what you should do. That part should be quite evident by now! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Checking if email is valid

2023-11-02 Thread dn via Python-list
, or (more likely) MailAdmin -> me) * however, this can end-up perpetuating the mistake, rather than correcting... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Checking if email is valid

2023-11-02 Thread dn via Python-list
ation that you'd fix the problem with the sender...). However, ... There are some large businesses doing what you've outlined. They have not solved this problem - and not through lack of trying! * as fast as you make something idiot-proof, the world will show you an 'improved' class of idiot! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Checking if email is valid

2023-11-01 Thread dn via Python-list
ge.Message: I just don't know why that particular line isn't working. Will need more context. What is the objective? What is the source/pre-processing of these data-items. (etc) * Left-out .au, (a less important geo-TLD) to wind-up @Chris... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Too Broad of an exception

2023-10-25 Thread dn via Python-list
ppear that (at least one message) did not make it to email - neither to the list-archive. People wishing to learn are unable to benefit a response, if it is not sent to the list! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: return type same as class gives NameError.

2023-10-22 Thread dn via Python-list
-reference" (because class has not yet been fully defined) - see https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html#forward-references -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Where I do ask for a new feature

2023-10-20 Thread dn via Python-list
Principle", "do one thing, and do it well", Law of Demeter, ...) Personal comment: my habit is to break specs into many classes and functions - sometimes more-so than others might prefer. Cannot recall when last had that hard-to-locate bug of unwittingly re-using a name/alias. (apologies: not a boast - a recommendation for going modular) -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: type annotation vs working code

2023-10-04 Thread dn via Python-list
On 04/10/2023 19.41, Chris Angelico via Python-list wrote: On Wed, 4 Oct 2023 at 15:27, dn via Python-list wrote: - should the class have been called either; class SomethingSingleton(): or a Singleton() class defined, which is then sub-classed, ie class Something( Singleton

Re: type annotation vs working code

2023-10-03 Thread dn via Python-list
Values is 'going'? - this article (https://python-patterns.guide/gang-of-four/singleton/) mentions that the original GoF Singleton Pattern preceded Python (particularly Python 3 classes). Also, that Python doesn't have complications present in C++. It further discusses "several drawbacks", which also champion 'readability' over 'trick' or 'sophistication'. I think you'll enjoy it! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: type annotation vs working code

2023-09-30 Thread dn via Python-list
On 01/10/2023 11.25, Karsten Hilbert via Python-list wrote: Am Sun, Oct 01, 2023 at 09:04:05AM +1300 schrieb dn via Python-list: class WorkingSingleton(Borg): def __init__(self): print(self.__class__.__name__, ':')

Re: type annotation vs working code

2023-09-30 Thread dn via Python-list
eady_initialized' for class 'WorkingSingleton'. but: self.already_initialized:bool passes without comment (see @Mats' response). Question: is it a legal expression (without the typing)? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: path to python in venv

2023-09-27 Thread dn via Python-list
it will be interesting to see if in-future, I notice when the project is based upon an older system! FYI https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-reloading-interpreter-paths.html (I'd be surprised if the other major tool-sets don't offer something

Re: Python Launcher Pops Up When Py-based App Is Running (Mac)

2023-09-18 Thread dn via Python-list
//www.python.org/doc/sunset-python-2/) - were this code to be written using today's libraries, it is unlikely to look anything like this (which may also be contributing to the dearth of replies) -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

ANN: Wed 20 Sep: Terminal-based user interfaces (TUIs) with ease using Textual

2023-09-07 Thread dn via Python-list
s, and IceHouse Ventures. -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Co-op Group: Django web framework

2023-08-28 Thread dn via Python-list
Learning Django Co-op. RSVP at https://www.meetup.com/nzpug-auckland/events/295727130/ -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Context manager for database connection

2023-08-23 Thread dn via Python-list
On 24/08/2023 06.11, dn via Python-list wrote: On 24/08/2023 03.41, Jason Friedman via Python-list wrote: with Database() as mydb: conn = mydb.get_connection() cursor = conn.get_cursor() cursor.execute("update table1 set x = 1 where y = 2") cursor.close() cursor = conn.

Re: Context manager for database connection

2023-08-23 Thread dn via Python-list
mydb.query( "update table1 set x = 1 where y = 2" ) mydb.query( "update table2 set a = 1 where b = 2" ) -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Imports and dot-notation

2023-08-09 Thread dn via Python-list
import identifier, ..." does not save storage-space over "import module" (the whole module is imported regardless, IIRC), however it does form an "interface" and thus recommend leaning into the "Interface Segregation Principle", or as our InfoSec brethren would say 'the principle of least privilege'. Accordingly, prefer "from ... import ... as ...". -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   >