Re: Checking if email is valid

2023-11-06 Thread rbowman via Python-list
for humans. -- https://mail.python.org/mailman/listinfo/python-list

Re: Checking if email is valid

2023-11-06 Thread MRAB via Python-list
On 2023-11-06 08:57, Simon Connah via Python-list wrote: I can see how the truley dim-witted might forget that other countries have phone numbers with differing lengths and formatting/punctuation, but there are tons of sites where it takes multiple tries when entering even a bog-standard USA

Re: Checking if email is valid

2023-11-06 Thread rbowman via Python-list
n in how to check fuses. At least with software you don't have to physically appear on site. -- https://mail.python.org/mailman/listinfo/python-list

Re: Writing to clipboard in Python 3.11

2023-11-07 Thread MRAB via Python-list
On 2023-11-06 00:51, Rob Cliffe via Python-list wrote: Recently I switched from Python 3.8.3 to Python 3.11.4.  A strange problem appeared which was not there before: I am using the win32clipboard backage (part of pywin32), and when I use SetClipboardData() to write text which consists ENTIRELY

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread dn via Python-list
On 08/11/2023 06.47, Egon Frerich via Python-list wrote: I've no idea why this happens. In a module there are lists and definitions: ...     ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])   File "/home/egon/Entw/Geldspur/geldspur/gui/GUI_Konf

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread MRAB via Python-list
On 2023-11-07 18:30, dn via Python-list wrote: On 08/11/2023 06.47, Egon Frerich via Python-list wrote: I've no idea why this happens. In a module there are lists and definitions: ...     ["%s%s%s " % (i[fCONV_AUSRICHTG], i[fLG2], i[fTYP]) for i in Felder])   File "/hom

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 MRAB via Python-list
On 2023-11-07 19:20, Jim Schwartz via Python-list wrote: Where do you define fCONV_AUSRICHTG? It must be initialized or defined somewhere. Did you leave out a statement from the python 2 version? It's given its value here: ( fNAME, fLG1, fLG2,

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread MRAB via Python-list
On 2023-11-07 20:56, Thomas Passin via Python-list wrote: On 11/7/2023 3:29 PM, MRAB via Python-list wrote: On 2023-11-07 19:20, Jim Schwartz via Python-list wrote: Where do you define fCONV_AUSRICHTG? It must be initialized or defined somewhere. Did you leave out a statement from the python 2

Re: Beep on WIndows 11

2023-11-12 Thread jak via Python-list
ser.com/questions/10575/turning-off-the-cmd-window-beep-sound> -- https://mail.python.org/mailman/listinfo/python-list

Re: Beep on WIndows 11

2023-11-12 Thread MRAB via Python-list
On 2023-11-12 11:16, Chris Angelico via Python-list wrote: On Sun, 12 Nov 2023 at 21:27, Y Y via Python-list wrote: I am curious and humble to ask: What is the purpose of a BEEP? There are several purposes. I can't say which of these are relevant to the OP, but some or all of them

Re: xor operator

2023-11-13 Thread Barry via Python-list
> On 13 Nov 2023, at 15:16, Dom Grigonis via Python-list > wrote: > > I think it could be useful to have `xor` builtin, which has API similar to > the one of `any` and `all`. I do not understand how xor(iterator) works. I thought xor takes exactly 2 args. I also do not und

Re: No current way to just compile flet code into truly native packages for smart phones, etc.?

2023-11-13 Thread Barry via Python-list
> On 13 Nov 2023, at 17:21, Jacob Kruger via Python-list > wrote: > > Had a look at the following bit of introduction to using python and flet to > build cross-platform flutter-based apps using same python code, and, while it > seems to work alright if tell it to run as

Re: xor operator

2023-11-13 Thread Barry via Python-list
mail.python.org/mailman/listinfo/python-list

Re: xor operator

2023-11-13 Thread MRAB via Python-list
On 2023-11-13 21:03, Barry via Python-list wrote: On 13 Nov 2023, at 17:48, Dom Grigonis wrote: Short circuiting happens, when: xor([True, True, False, False], n=1) At index 1 it is clear that the answer is false. Can you share an example with 4 values that is true? And explain why it is

Re: Code improvement question

2023-11-14 Thread MRAB via Python-list
On 2023-11-14 23:14, Mike Dewhirst via Python-list wrote: I'd like to improve the code below, which works. It feels clunky to me. I need to clean up user-uploaded files the size of which I don't know in advance. After cleaning they might be as big as 1Mb but that would be super rar

Re: Code improvement question

2023-11-14 Thread MRAB via Python-list
On 2023-11-15 03:41, Mike Dewhirst via Python-list wrote: On 15/11/2023 10:25 am, MRAB via Python-list wrote: On 2023-11-14 23:14, Mike Dewhirst via Python-list wrote: I'd like to improve the code below, which works. It feels clunky to me. I need to clean up user-uploaded files the si

Re: Newline (NuBe Question)

2023-11-15 Thread dn via Python-list
On 15/11/2023 20.25, Grizzy Adams via Python-list wrote: Hi & thanks for patience with what could be simple to you Have this (from an online "classes" tutorial) There are lots of on-line classes! --- Start Code Snippit --- students = [] grades = [] for s in

Re: Code improvement question

2023-11-16 Thread MRAB via Python-list
On 2023-11-17 01:15, Mike Dewhirst via Python-list wrote: On 15/11/2023 3:08 pm, MRAB via Python-list wrote: On 2023-11-15 03:41, Mike Dewhirst via Python-list wrote: On 15/11/2023 10:25 am, MRAB via Python-list wrote: On 2023-11-14 23:14, Mike Dewhirst via Python-list wrote: I'd li

Re: Code improvement question

2023-11-17 Thread jak via Python-list
Mike Dewhirst ha scritto: On 15/11/2023 10:25 am, MRAB via Python-list wrote: On 2023-11-14 23:14, Mike Dewhirst via Python-list wrote: I'd like to improve the code below, which works. It feels clunky to me. I need to clean up user-uploaded files the size of which I don't know

Re: Code improvement question

2023-11-17 Thread MRAB via Python-list
On 2023-11-17 09:38, jak via Python-list wrote: Mike Dewhirst ha scritto: On 15/11/2023 10:25 am, MRAB via Python-list wrote: On 2023-11-14 23:14, Mike Dewhirst via Python-list wrote: I'd like to improve the code below, which works. It feels clunky to me. I need to clean up user-upl

Re: Code improvement question

2023-11-17 Thread jak via Python-list
nk about it. Sorry. -- 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: on writing a number as 2^s * q, where q is odd

2023-11-29 Thread jak via Python-list
? def powers_of_2_inB(n): bc = (n ^ (n - 1)).bit_count() - 1 return bc, int(n / (1 << bc)) -- https://mail.python.org/mailman/listinfo/python-list

FridayFinking - Was: A beginning beginner's question about input, output and . . .

2021-01-13 Thread dn via Python-list
ing as it once did, there's plenty of other 'inspiration', eg a parallel discussion 'here' about the virtues of a programmer positioning dialog(ue)s/windows or leaving it to the window manager... I'll give it some thought - as long as Fridays keep coming! -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Application window geometry specifier

2021-01-13 Thread dn via Python-list
uch as when to use radio-buttons and when check-boxes. I can't tell you if the gtk, qt, or wx people offer something similar... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Friday Finking: Abstract Base Classes - love or hate

2021-01-14 Thread dn via Python-list
an't instantiate i/Image directly" ) class Non_Image( Image ): def load_file( self, filename:str ): """This looks reasonable.""" try: n = Non_Image( "Under Exposed" ) except TypeError: print( "Sorry, n/Non_Image does not look good" ) class PNG_Image( Image ): def load( self, filename:str ): """Load PNG file.""" def save( self, filename:str ): """Save to PNG file.""" p = PNG_Image( "Picture of the Artist as a Young Man" ) print( "p has instantiated successfully" ) -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

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

2021-01-15 Thread dn via Python-list
ly might it have been literally the end of (your) day. This conversation does seem to have reached the point of reductio ad absurdum! -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

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

2021-01-15 Thread dn via Python-list
keenly appreciate (that makes me "[feel] good", to borrow your words), is that not only are "batteries included", but I don't have to carry-around any 'spare batteries' that I don't actually need right now! (even more applicable when using MicroPython, etc) -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

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

2021-01-15 Thread dn via Python-list
; > It's a common condition. There are three components: 1 From the Greek: "con" meaning 'against' or 'unable'. 2 From tech-jargon (and the Australian habit of shortening every word in the English language): "fuzz" is the contraction of two highly-technical terms, famously applied in intro courses and by naive job-interviewers. 3 From English: the suffix "ed" meaning past tense. Thus, (smirking!) "confuzzed" is the psychological term for people who have never been able to bend their minds around the "fizz-buzz" coding challenge. PS am running for cover before @Chris reads this... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: open sentinel-2image python

2021-01-17 Thread dn via Python-list
e general public are of the order of tens of mega-bytes. (a URL might help people trying to replicate the problem!) Be advised that everyone 'here' is a volunteer. Please help us to help you! -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

IDE tools to debug in Python?

2021-01-27 Thread flaskee via Python-list
meone mentioning such a python tool in the prior thread. Thanks! -- https://mail.python.org/mailman/listinfo/python-list

Re: IDE tools to debug in Python?

2021-01-27 Thread flaskee via Python-list
M Michał Jaworski wrote: > >> PyCharm has all these debugging capabilities and there is a community >> edition that you can use for free. If you earn for the living with Python it >> is worth investing in professional edition though. >> >> Michał Jaworski >&

Re: IDE tools to debug in Python?

2021-01-27 Thread flaskee via Python-list
uppose > > ---- > > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: Response for PING in ircbot.

2021-02-03 Thread dn via Python-list
me (odd) suffix, then why not slice the string [ :-2 ]? Alternately, consider str.translate() where both character codes are removed, regardless of location. -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

RE: IDE tools to debug in Python?

2021-02-05 Thread flaskee via Python-list
It looks like it will be Wing IDE and maybe pyscripter to start. Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Selenium finds object that is interactible but says otherwise

2021-02-06 Thread dn via Python-list
On 07/02/2021 08.21, Philipp Daher via Python-list wrote: > Hello, > > > I recently programmed some code for a webdriver with selenium. > I asked the program to find an input tag, which is interactible, with this: >     > searchbar=driver.find_element_by_class_name(&quo

Re: Response for PING in ircbot.

2021-02-07 Thread flaskee via Python-list
e causing this under /var/log/*, or apache's error log; or the site's access/error logs. What I'd like to do is set up my own external monitor, to at least known WHEN the site has died. And I'm wondering if your PING might be better. Thanks! -- https://mail.python.org/mailman/listinfo/python-list

Re: Python cannot count apparently

2021-02-07 Thread dn via Python-list
On 08/02/2021 09.49, Kevin M. Wilson via Python-list wrote: > Set i = 0 at the begin of the code, that way each entry starts at Logical 0 > of the array/container/list... FYI: https://docs.python.org/3/library/stdtypes.html#typesseq-range See also @Chris' contribution regarding t

Re: Fwd: Inconveniente

2021-02-09 Thread dn via Python-list
to questions. [Cordialmente] -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Response for PING in ircbot.

2021-02-09 Thread flaskee via Python-list
no errors that might be causing this under /var/log/*, or apache's error log; or the site's access/error logs. What I'd like to do is set up my own external monitor, to at least known WHEN the site has died. And I'm wondering if your PING might be better. Thanks! -- https:/

Re: installation issues

2021-02-09 Thread dn via Python-list
(particularly the Beginner's Guide) https://www.python.org/doc/ (for everything, but start with "Using Python") -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: New Python implementation

2021-02-11 Thread dn via Python-list
'execution speed' becomes a major criteria. Many of us will look forward to (your development of) a solution. Please let us know when it's ready for use/trials... Personal comments: 1 Am admitting to a sense of wariness towards 'new' people who use a made-up name - despite mine being somewhat obfuscated (NB calling "David?" in any given community is likely to elicit multiple replies, thus the "dn"/inviting colleagues to call me by my initials). 2 Noting a false (non-standard/RFC) email address, and consequently every message's (non-standard) impact on the email-reflector. 3 My mind is whirling in an attempt to understand "show me a better time". Does this perhaps indicate that @Chris' social life leaves something to be desired? Are Python-nerds really the ones to turn-to for dating advice, or is that not what @Chris means by "(having) a good time"? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: New Python implementation

2021-02-11 Thread dn via Python-list
On 12/02/2021 08.53, Chris Angelico wrote: > On Fri, Feb 12, 2021 at 6:47 AM dn via Python-list > wrote: >> 3 >> My mind is whirling in an attempt to understand "show me a better time". >> Does this perhaps indicate that @Chris' social life leaves somet

Re: mutating a deque whilst iterating over it

2021-02-11 Thread dn via Python-list
also allows deque-mutation, then the first value(s), previously printed, will no longer exist within the queue. I'm enjoying the question: wither inconsistency? Perhaps someone (wiser) will jump in... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: PSYCOPG2

2021-02-13 Thread dn via Python-list
On 13/02/2021 18.34, Mladen Gogala via Python-list wrote: > On Fri, 12 Feb 2021 18:29:48 +, Tony Ogilvie wrote: > >> I am trying to write a program to open a PostgesSQL 13 database using >> psycopg2. All seems to work if I write direct to Python but if I write >> the

Re: Is email.message.get() case insensitive for the header name?

2021-02-15 Thread dn via Python-list
hen used in "folding" and "unfolding", as described in section 2.2.3. All field bodies MUST conform to the syntax described in sections 3 and 4 of this specification. ... >>> -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Mr. Flibble

2021-02-15 Thread dn via Python-list
Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: New Python implementation

2021-02-15 Thread dn via Python-list
o execute, which made it a competent fore-runner of Micro-Python (etc) in the micro and single-board computer arenae/arenas. Without Python, I think I'd prefer to use (an updated) UCSD-Pascal or Borland Turbo-Pascal to this very day! PL/I, not so much - even on a mainframe project! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: use set notation for repr of dict_keys?

2021-02-20 Thread dn via Python-list
t-like #list data structure maintains the sequence of its elements, a set #set is not required to do so. Thus, if "k" were a set, what is produced on your machine may be different to what happens on mine/no guarantees: Possibly @Wolfgang's machine = >>> k { 'one', 'two' } Possibly @dn's machine = >>> k { 'two', 'one' } Thus no guarantee that when we try to re-combine keys and values they would correspond correctly! - and if we applied the same to data - even worse: combinatorial issue! Web.Refs: #repr: https://docs.python.org/3/reference/datamodel.html#basic-customization #list: and #set: https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a way to subtract 3 from every digit of a number?

2021-02-20 Thread dn via Python-list
ow has the student proven that (s)he has learned the material? (apologies for criticism: I readily assume your motivation was to be helpful) The problem is a Caesar Cipher - disguised, because most examples/usage of such is for alphanumeric messages. This topic is often used for ComSc examples to demonstrate modulo arithmetic and/or circular data structures, eg a bounded-queue (per other's responses). -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Deleting Python 3.8.5

2021-02-22 Thread dn via Python-list
the system is 'clean', then start-again... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

is not recognized as an internal or external command, operable program or batch file.

2021-03-01 Thread singh.veer99999--- via Python-list
://go.microsoft.com/fwlink/?LinkId=550986 -- https://mail.python.org/mailman/listinfo/python-list

Re: Why assert is not a function?

2021-03-02 Thread Mirko via Python-list
serts, but logging. Having "assert" being a function would make it much harder to get rid of it in production code. -- https://mail.python.org/mailman/listinfo/python-list

Re: program python

2021-03-04 Thread dn via Python-list
guage into Python? Thereafter tackle problems two and three. We don't know your level of Python skill. So, let us know how you get-on, and come back with sample code, if you strike a problem at any step. -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: neonumeric - C++ arbitrary precision arithmetic library

2021-03-06 Thread Mirko via Python-list
here's the same expression in (GNU) Smalltalk: st> 3+3*5 30 How would such a universal compiler know which evaluation strategy to follow, if not by writing a parser end evaluator for every supported language? And if it's hard for this simple problem, how about more complex cases. -- https://mail.python.org/mailman/listinfo/python-list

Re: Apriori Algorithm

2021-03-07 Thread dn via Python-list
t; 71 208 217 266 279 290 458 478 523 614 766 853 888 944 969 > 43 70 176 204 227 334 369 480 513 703 708 835 874 895 > 25 52 278 730 > 151 432 504 830 890 Great! For what purpose - is this a 'homework assignment'? What code do you have so far? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: neonumeric - C++ arbitrary precision arithmetic library

2021-03-08 Thread Mirko via Python-list
Am 07.03.2021 um 21:52 schrieb Avi Gross via Python-list: > The precedence example used below made a strange assumption that the > imaginary program would not be told up-front what computer language it was > being asked to convert from. That is not the scenario being discussed as

Re: Found a problem

2021-03-09 Thread dn via Python-list
lem into smaller units of code ("subroutines"), and checking that each of them works (correctly). Alternately, I follow a practice called "TDD" (Test-Driven Development), whereby each large problem is broken-down into subroutines, and then each subroutine is individually created and tested. Further tests will ensure that as the smaller-units are combined, they work-together correctly. Finally, when all are combined, we expect that the entire system will work. The original code appeared to work, but one small part (ie do these divisors reveal that the number is "perfect"?) was not correct. Accordingly, the whole program[me] failed. The (great) people who create the Python language and its interpreter did not let us down! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Please don't feed the trolls

2021-03-09 Thread dn via Python-list
ment and self-banishment - and a protagonist whose Last Will and Testament read: "That Elizabeth-Jane Farfrae be not told of my death, or made to grieve on account of me. that I be not bury'd in consecrated ground. that no sexton be asked to toll the bell. that nobody is wished to see my dead body. that no murners walk behind me at my funeral. that no flours be planted on my grave, that no man remember me." RiP - and this thread also! -- -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Why assert is not a function?

2021-03-11 Thread dn via Python-list
the point:- (Scenarios 1 and 2, plus leaving the asserts to run in case of 'accidents' during production-execution) When testing the integrity of some collection of data, why use assert over raising a descriptive and class-identified exception? Both can be trapped by 'higher-level' code. Both can provide text-planations. Is assert so much faster/cheaper than try...except...raise? -- -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Friday Finking: following, weirdness with list()

2021-03-11 Thread dn via Python-list
MP4). Am working on a similar container format at the moment, where the length of sub-components may be reported in bytes (if not delineated by 'markers'). So, there are many reasons why "bytes" is a 'good' measure of length - in this context. Is it "misusing __len__" in a class/object designed to manipulate such files? Hope not! (or I'm 'in trouble' - again...) -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Why assert is not a function?

2021-03-11 Thread dn via Python-list
On 12/03/2021 11.27, Chris Angelico wrote: > On Fri, Mar 12, 2021 at 9:10 AM Ethan Furman wrote: >> >> On 3/11/21 1:45 PM, dn via Python-list wrote: >> >>> Is assert so much faster/cheaper than try...except...raise? >> >> Infinitely faster when they ar

Re: file location/directory

2021-03-14 Thread dn via Python-list
t;; or you can use both components, eg open( os.path.join( path, file_name )... So, now by setting the "path" according to "that folder", and adding the requisite file-name(s), will that answer the need? Remember that a path may be "absolute" or "relative", according to need. -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: file location/directory

2021-03-16 Thread dn via Python-list
PYTHONPATH, you will either have to provide a mechanism to install such for your users, or ask them to do it manually! (hint: users want to play the game, so don't expect them to be *nix command-line experts) -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: .title() - annoying mistake

2021-03-19 Thread dn via Python-list
el Suit' > > should be > > 'The Man in the Grey Flannel Suit' To be fair, aren't book-titles* a (formalised) sub-set of the English language? https://www.librarianshipstudies.com/2018/12/anglo-american-cataloguing-rules-aacr.html * plays, movies, ... See also people's/family-names which have been anglicised or transliterated... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: .title() - annoying mistake

2021-03-19 Thread dn via Python-list
ing your reliance upon a tool whose objective is 'convenience', can lead you "down the garden path"&! & Web.Refs: https://academy.finxter.com/university/python-built-in-functions-every-python-coder-must-know/ (https://www.udemy.com/course/the-python-built-in-function-tutorial-series/) (https://techvidvan.com/tutorials/python-built-in-functions/) https://www.w3schools.com/python/ref_string_title.asp https://docs.python.org/3.9/library/stdtypes.html#str.title https://idioms.thefreedictionary.com/lead+down+the+garden+path -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: .title() - annoying mistake

2021-03-22 Thread dn via Python-list
On 23/03/2021 10.00, Avi Gross via Python-list wrote: > Speaking for myself, I am beyond tired of this topic, however informative > parts have been. +1 > I will say it is irrational to try to impose rationally across all possible > languages, let alone people like me who often combi

Re: Code Formatter Questions

2021-03-28 Thread dn via Python-list
to generalise horizontal-formatting is probably creating hoops-to-jump-through. Such may have been worthy of a stereotypical (and much vilified) 1960s civil service; but not of someone with expertise in modern programming languages. Embrace diversity! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Code Formatter Questions

2021-03-29 Thread dn via Python-list
r you spent time helping me with a design/coding problem, helping debug, and/or reviewing/improving my code (and I for you); than we had not time left-over after spending many hours and much mental energy arguing about whether this format is [more] right than that! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread dn via Python-list
rt copy dod = { "alice": { "lang": "python", "level": "expert" }, "bob": { "lang": "perl", "level": "noob" } } original = copy.deepcopy( dod ) lod = [] for name in dod: d = dod[name] d["name"] = name lod.append(d) print( original == dod ) pp(dod) pp(original) False {'alice': {'lang': 'python', 'level': 'expert', 'name': 'alice'}, 'bob': {'lang': 'perl', 'level': 'noob', 'name': 'bob'}} {'alice': {'lang': 'python', 'level': 'expert'}, 'bob': {'lang': 'perl', 'level': 'noob'}} -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Canonical conversion of dict of dicts to list of dicts

2021-03-30 Thread dn via Python-list
#x27;, 'level': 'expert', 'name': 'alice'}, >> 'bob': {'lang': 'perl', 'level': 'noob', 'name': 'bob'}} >> {'alice': {'lang': 'python', 'level': 'expert'}, >> 'bob': {'lang': 'perl', 'level': 'noob'}} > > Thanks for pointing that out. Coming from Perl that's something I need > to watch out for. So if I do > > $ a = ["alice", "bob", "carol"] > $ b = a > $ b[1] = "bert" > $ b > ['alice', 'bert', 'carol'] > $ a > ['alice', 'bert', 'carol'] > > I see that changing one list changes the other because 'a' and 'b' are > just bindings to the same object. However, If I look at non-list > variables: > >$ a = "bob" >$ b = a >$ b = "bert" >$ a > 'bob' > > that doesn't happen. What's the rational for that and where can I find > it in the Python documentation? Good observation! Important to differences. Python offers mutable (can be changed) and immutable (can't) objects (remember: 'everything is an object'): https://docs.python.org/3/reference/datamodel.html?highlight=mutable%20data PS this even applies when the two identifiers pointing at the same object are argument(s) to a function! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-03-31 Thread dn via Python-list
;Chris" duration_of_treatment = "life" Thus, design suggestion: add a 'back-door' to the __init_subclass__ to ensure access to the Internet from any/all buildings! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-03-31 Thread dn via Python-list
On 01/04/2021 13.54, Chris Angelico wrote: > On Thu, Apr 1, 2021 at 11:39 AM dn via Python-list > wrote: >> >> On 01/04/2021 12.14, Chris Angelico wrote: >>> I think this code makes some sort of argument in the debate about >>> whether Python has too

Re: XanaNews Statistic for comp.lang.python. 4/1/2021 5:52:47 AM

2021-04-01 Thread dn via Python-list
On 02/04/2021 01.19, Chris Angelico wrote: > On Thu, Apr 1, 2021 at 10:56 PM The Doctor via Python-list > wrote: >> Top Posters >> >> Ranking Articles NameMost Used Newsreader >> --- -- ---

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-01 Thread dn via Python-list
On 02/04/2021 10.13, Chris Angelico wrote: > On Fri, Apr 2, 2021 at 7:52 AM David L Neil via Python-list > wrote: >> Officially April-Fools Day is over (here), but... > This wasn't a prank post, although it was intended to give amusement > rather than real education or

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-02 Thread dn via Python-list
On 02/04/2021 21.32, Alan Gauld via Python-list wrote: > On 02/04/2021 00:42, dn via Python-list wrote: > >> Contrarily "tuck" in (old) English slang represented "sweets" (or > > Not that old. We still use it occasionally today. And we > certainly had

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-02 Thread dn via Python-list
On 02/04/2021 13.00, Chris Angelico wrote: > On Fri, Apr 2, 2021 at 10:43 AM dn via Python-list > wrote: >> >> On 02/04/2021 10.13, Chris Angelico wrote: >>> Well, it's a simple matter of chronology. First you have crude oil, >>> then time passes, and th

Friday Finking: initialising values and implied tuples

2021-04-02 Thread dn via Python-list
nds you into submission? Perhaps you have different approaches depending upon the number of objects in the 'list' and the proximity of column-79, or by nature of the application? -- -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Horrible abuse of __init_subclass__, or elegant hack?

2021-04-02 Thread dn via Python-list
ome of the 'squares' are significantly larger/smaller than others! > I'd upload a patch for that, but it doesn't seem to be > open source. At least I can't find it on chochub. Recommend you use our local facility: https://git.nzoss.org.nz/users/sign_in -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Friday Finking: initialising values and implied tuples

2021-04-04 Thread dn via Python-list
r crude above/to-the-left?" > > Cognitive burden slows down and fatigues. +1 > Alternatively, if the data "fits together", use a `namedtuple` with kwarg > initialisation or structured data types like `dataclasses`. Whereas the other formats cannot, it would be very easy to turn an (a) type of list into a dataclass! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Friday Finking: initialising values and implied tuples

2021-04-04 Thread dn via Python-list
On 04/04/2021 01.00, Rob Cliffe via Python-list wrote: > > > On 03/04/2021 04:09, 2qdxy4rzwzuui...@potatochowder.com wrote: >> On 2021-04-03 at 02:41:59 +0100, >> Rob Cliffe via Python-list wrote: >> >>> x1 = 42; y1 =  3;  z1 = 10 >>> x

Re: HELP Please, Python Program Help

2021-04-10 Thread dn via Python-list
the above/ > print(x) > > # This function divides two numbers > def divide(x, y): > return x / y Why use a function instead of operating in-line? -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Ann: New Python curses book

2021-04-10 Thread Russell via Python-list
re, so the > shipping cost by far outweighs the book???s cost. Hope for other???s sake, > it migrates to the other Amazon stores fairly quickly. > > Thanks, > Bill > >> On Mar 30, 2021, at 7:12 AM, Alan Gauld via Python-list >> wrote: >> >> I&#x

Re: all versions of python fail to indent after conditional statement

2021-04-10 Thread Russell via Python-list
t; >... print('too bad') > > File "", line 2 > >print('too bad') > >^ > >IndentationError: expected an indented block > >>>> Microsoft Windows [Version 10.0.19041.867] > > > > > >Sent from [1]Mail for Windows 10 > > > > References > >Visible links >1. https://go.microsoft.com/fwlink/?LinkId=550986 -- rust 0x68caecc97f6a90122e51c0692c88d9cb6b58a3dc -- https://mail.python.org/mailman/listinfo/python-list

Re: Style qeustion: Multiple return values

2021-04-12 Thread dn via Python-list
#x27; the equals/assignment. Thus, the answer to your question is a matter of style, and thus the understanding of those who might read the code. FWIW: I leave them out because it is easier on my eyes whilst scanning the line of code. -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Style qeustion: Multiple return values

2021-04-12 Thread dn via Python-list
On 12/04/2021 22.32, Chris Angelico wrote: > On Mon, Apr 12, 2021 at 8:20 PM dn via Python-list > wrote: >> >> On 12/04/2021 20.29, Steve Keller wrote: >>> Just a short style question: When returning multiple return values, do >>> you use parenthesis? >>

Re: UI design: combobox or radiobuttons?

2021-04-13 Thread Mirko via Python-list
if radios would make the view more complex and less obvious. -- https://mail.python.org/mailman/listinfo/python-list

Re: [ANN] Free Python tutorial with exercises, cscx.org

2021-04-13 Thread Russell via Python-list
/listinfo/python-list

Re: need help with a translation issue

2021-04-17 Thread dn via Python-list
x27;s there to stop some nefarious/stupid user (like me!) entering "gobbledegook" and complaining that the program fails? -- -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: need help with a translation issue

2021-04-17 Thread dn via Python-list
' - or are they 'ideas' - might be! Here's another: "YAGNI" (You Aren't Going to Need It) - don't try to make a simple program into the be-all-and-end-all just in-case some idiot (I mean: nice person, like me) comes along asking for database-output. That said, designing for 'independence' will facilitate such extensions, should they (ever) be required. - and another: "YMMV" (Your Mileage May Vary) - from the motor industry expecting us to excuse their outlandish claims about how little fuel a car requires/how many miles or km it will travel on a single electric-charge. We apply it to say that what my team thinks is 'the one true way' to do things, may be quite different to what you/your team think is 'correct'! NB 'umble scribe has (lazily) not tested these code-snippets Web.Ref: https://towardsdatascience.com/5-principles-to-write-solid-code-examples-in-python-9062272e6bdc -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Comparing text strings

2021-04-18 Thread dn via Python-list
tly-written in Python (it may still employs the older rpm, even yum, code). Maybe the OP could learn from, or even piggy-back off, the existing code? (which may be at https://github.com/rpm-software-management/dnf) -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Determine what the calling program is

2021-04-18 Thread dn via Python-list
include a note that each file has/not been processed (plus any other stats or logging you may deem appropriate). A third state would be 'in process'. Now, at start-up, the application can quickly check to see if there is any file in that state... -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: do ya still use python?

2021-04-20 Thread dn via Python-list
On 20/04/2021 20.32, Alan Gauld via Python-list wrote: > On 20/04/2021 04:47, Dan Stromberg wrote: > >> Actually, this list is less busy than it was a decade or two ago, but >> that's probably because of things like stackoverflow, python-dev, pypy-dev, >> cython-devel

Re: Ad-hoc SQL query builder for Python3?

2021-04-24 Thread dn via Python-list
Builder(s) Sundry tools built on PHP - for varying definitions of F/LOSS and 'ad-hoc'! -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Ad-hoc SQL query builder for Python3?

2021-04-25 Thread dn via Python-list
and motivation behind them, or have they (perhaps) had the effect of de-motivating the very people who seek to be helpful (to you)? Please note: The questions (above) are Socratic and rhetorical. No reply is requested or required. They ask you to think about maintaining constructive relationships. You certainly do not need to explain yourself to us (nor us to you). Per the opening comment, the idea behind this message is that we become better at helping each other... -- -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Start Python programming

2021-04-27 Thread dn via Python-list
t the same site. There are plenty of books and both $free and paid courses available on-line, to suit many preferred ways of learning, and covering many specialised applications of the language. -- Regards, =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: text displays on screen only when I click to exit the program

2021-04-30 Thread Mirko via Python-list
this is > all on my own, and I don't know why the text displays when I close the > python window. > I appreciate all help :) Because you are calling display_instruction() and pygame.display.update() outside of the game loop. Try to indent those two lines one level more. -- https://mail.python.org/mailman/listinfo/python-list

Re: Start Python programming

2021-04-30 Thread Russell via Python-list
d a copy too. It has lots of practical examples and is easy to read/follow. -- rust 0x68caecc97f6a90122e51c0692c88d9cb6b58a3dc -- https://mail.python.org/mailman/listinfo/python-list

OT: Autism in discussion groups (was: Re: Proposal: Disconnect comp.lang.python from python-list)

2021-05-08 Thread Mirko via Python-list
s or behavior. A fluffy cloud echo chamber where everybody just accepts and respects you for what you are. Does the concept sound familiar? P.S.: *NOT* among the core symptoms of (the high-functioning levels) of ASS is the inability to learn. Mind that! (And that includes social norms.) -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   9   10   >