Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-07 Thread Greg Ewing via Python-list
cases, such as this one. There are various ways you could work around this. I would suggest moving the offending code outside the class and qualifying the constants it uses with the class name. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Help

2023-11-07 Thread Mike Dewhirst via Python-list
On 7/11/2023 9:02 am, Jason Friedman via Python-list wrote: On Sun, Nov 5, 2023 at 1:23 PM office officce via Python-list < python-list@python.org> wrote: which python version is better to be used and how to make sure it works on my window 10 because i downloaded it and it never worke

on a tail-recursive square-and-multiply

2023-11-07 Thread Julieta Shem via Python-list
nge the base. That seems too much for my small head. Can you help? -- https://mail.python.org/mailman/listinfo/python-list

Re: on a tail-recursive square-and-multiply

2023-11-07 Thread Michael Torrie via Python-list
On 11/7/23 18:26, Julieta Shem via Python-list wrote: > For the first time I'm trying to write a tail-recursive > square-and-multiply and, even though it /seems/ to work, I'm not happy > with what I wrote and I don't seem to understand it so well. > &g

Re: on a tail-recursive square-and-multiply

2023-11-07 Thread Greg Ewing via Python-list
lone when the exponent is even. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: fCONV_AUSRICHTG is not defined - Why?

2023-11-08 Thread Egon Frerich via Python-list
Am 07.11.23 um 20:10 schrieb 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],

Re: on a tail-recursive square-and-multiply

2023-11-08 Thread Julieta Shem via Python-list
= e - 1 return remainder(r, m) --8<---cut here---end--->8--- So, indeed, it is asymmetric. When it's even, I change the base. When it's odd, I change the /r/eturning value. Thank you so much. (*) The remainder function --8<---cut here---start->8--- def is_even(n): return remainder(n, 2) == 0 def remainder(a, b): return a % b --8<---cut here---end--->8--- -- https://mail.python.org/mailman/listinfo/python-list

Re: on a tail-recursive square-and-multiply

2023-11-09 Thread Julieta Shem via Python-list
gger inside some_call() whereas you expected to have taken the other branch, with TCO as a feature your debugger can't tell you the value of x and y, because the stack frame has been eliminated. --8<---cut here-------end--->8--- -- https://mail.python.org/mailman/listinfo/python-list

SQL rollback of multiple inserts involving constraints

2023-11-10 Thread Loris Bennett via Python-list
doing wrong? Apologies if this is actually an SQL question rather than something related to SQLAlchemy. Cheers, Loris -- This signature is currently under constuction. -- https://mail.python.org/mailman/listinfo/python-list

Re: SQL rollback of multiple inserts involving constraints

2023-11-10 Thread Jacob Kruger via Python-list
ruger +2782 413 4791 "Resistance is futile!...Acceptance is versatile..." On 2023/11/10 11:15, Loris Bennett via Python-list wrote: Hi, In my MariaDB database I have a table 'people' with 'uid' as the primary key and a table 'groups' with 'gid'

SQLObject 3.11.0

2023-11-11 Thread Oleg Broytman via Python-list
ohn' >>> p.mi = 'Q' >>> p2 = Person.get(1) >>> p2 >>> p is p2 True Queries:: >>> p3 = Person.selectBy(lname="Doe")[0] >>> p3 >>> pc = Person.select(Person.q.lname=="Doe").count() >>> pc 1 Oleg. -- Oleg Broytmanhttps://phdru.name/p...@phdru.name Programmers don't die, they just GOSUB without RETURN. -- https://mail.python.org/mailman/listinfo/python-list

Beep on WIndows 11

2023-11-11 Thread Rob Cliffe via Python-list
beep. Can anyone shed light on this, and perhaps give a simpler fix? Best wishes Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

RE: Beep on WIndows 11

2023-11-12 Thread Y Y via Python-list
I am curious and humble to ask: What is the purpose of a BEEP? -Original Message- From: Python-list On Behalf Of Rob Cliffe via Python-list Sent: Sunday, November 12, 2023 6:50 AM To: Python Subject: Beep on WIndows 11  Apologies if this is not a Python question. I  recently moved

Re: Beep on WIndows 11

2023-11-12 Thread Dan Sommers via Python-list
On 2023-11-11 at 23:44:19 +, Y Y via Python-list wrote: > I am curious and humble to ask: What is the purpose of a BEEP? It's a simple way for a terminal-based program to alert (hence '\a') a user or an operator that their attention is requested or required

Re: Beep on WIndows 11

2023-11-12 Thread Chris Angelico via Python-list
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 could easily be. * A very very simple notificati

Re: Beep on WIndows 11

2023-11-12 Thread Chris Angelico via Python-list
On Mon, 13 Nov 2023 at 04:13, MRAB via Python-list wrote: > In the old days, with a BBC micro, that was simple. It had 3 tone > channels and 1 white noise channel, with control over frequency, > duration and volume, beeps on different channels could be synchronised > to start at t

Re: SQL rollback of multiple inserts involving constraints

2023-11-13 Thread Loris Bennett via Python-list
n-a-flush-and-commit-baec6c2410a9 > > > HTH Yes, thank you, it does. I hadn't been aware of 'flush'. > Jacob Kruger > +2782 413 4791 > "Resistance is futile!...Acceptance is versatile..." > > > On 2023/11/10 11:15, Loris Bennett via Python-list wrot

xor operator

2023-11-13 Thread Dom Grigonis via Python-list
those that do contain loops that result in very poor performance. Regards, DG -- https://mail.python.org/mailman/listinfo/python-list

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

2023-11-13 Thread Jacob Kruger via Python-list
flet.dev/docs/guides/python/deploying-web-app/progressive-web-apps/> -- Jacob Kruger +2782 413 4791 "Resistance is futile!...Acceptance is versatile..." -- https://mail.python.org/mailman/listinfo/python-list

Re: xor operator

2023-11-13 Thread Dom Grigonis via Python-list
. Regards, DG > On 13 Nov 2023, at 19:42, Barry wrote: > > > >> 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`. >

Re: xor operator

2023-11-13 Thread Michael Speer via Python-list
. for intermediate in itertools.accumulate( iterable, (lambda x, y: x + bool(y)), initial = 0 ): ... if intermediate > n: ... return False ... return intermediate == n On Mon, Nov 13, 2023 at 4:05 PM Barry via Python-list < python-list@python.org> wrote: > > > > On 13 Nov 2023,

Re: xor operator

2023-11-13 Thread Dom Grigonis via Python-list
> And explain why it is xor. > > Barry > -- https://mail.python.org/mailman/listinfo/python-list

Re: xor operator

2023-11-13 Thread Axel Reichert via Python-list
be short circuited. Me neither, but that could be related to the meaning of n (which I did not get) in the OP's question. Maybe he can clarify. Best regards Axel -- https://mail.python.org/mailman/listinfo/python-list

Re: xor operator

2023-11-13 Thread Chris Angelico via Python-list
On Tue, 14 Nov 2023 at 08:57, Axel Reichert via Python-list wrote: > > Barry writes: > > > I do not understand how xor(iterator) works. > > I thought xor takes exactly 2 args. > > See > > https://mathworld.wolfram.com/XOR.html > > for some background (I w

Re: xor operator

2023-11-13 Thread Dom Grigonis via Python-list
urn intermediate == n > > > > On Mon, Nov 13, 2023 at 4:05 PM Barry via Python-list <mailto:python-list@python.org>> wrote: > > > > On 13 Nov 2023, at 17:48, Dom Grigonis > <mailto:dom.grigo...@gmail.com>> wrote: > > > > Short circuit

Re: xor operator

2023-11-13 Thread Grant Edwards via Python-list
On 2023-11-13, Dom Grigonis via Python-list wrote: > Hi All, > > I think it could be useful to have `xor` builtin, which has API similar to > the one of `any` and `all`. > > * Also, it could have optional second argument `n=1`, which > * indicates how many positives indicate

Re: xor operator

2023-11-13 Thread Dom Grigonis via Python-list
applied to many bits. This is more in line with cases that `any` and `all` builtins are used. > On 14 Nov 2023, at 00:51, Grant Edwards via Python-list > wrote: > > On 2023-11-13, Dom Grigonis via Python-list wrote: >> Hi All, >> >> I think it could be useful to

Re: xor operator

2023-11-13 Thread Chris Angelico via Python-list
On Tue, 14 Nov 2023 at 10:00, Dom Grigonis via Python-list wrote: > > I am not asking. Just inquiring if the function that I described could be > useful for more people. > > Which is: a function with API that of `all` and `any` and returns `True` if > specified number o

Re: xor operator

2023-11-13 Thread Dom Grigonis via Python-list
some time to even convey what I mean. Bad naming didn’t help ofc, but if it was something that is needed I think it would have clicked much faster. Thanks, DG > On 14 Nov 2023, at 01:12, Chris Angelico via Python-list > wrote: > > On Tue, 14 Nov 2023 at 10:00, Dom Grigonis via

Re: xor operator

2023-11-13 Thread Grant Edwards via Python-list
On 2023-11-13, Dom Grigonis via Python-list wrote: > I am not asking. Just inquiring if the function that I described > could be useful for more people. > > Which is: a function with API that of `all` and `any` and returns > `True` if specified number of elements is True. I'

Re: xor operator

2023-11-13 Thread Dom Grigonis via Python-list
n Number of True values. Fair point. Have you ever encountered the need for xor for many bits (the one that I am NOT referring to)? Would be interested in what sort of case it could be useful. -- https://mail.python.org/mailman/listinfo/python-list

Re: xor operator

2023-11-13 Thread Mats Wichmann via Python-list
On 11/13/23 16:24, Dom Grigonis via Python-list wrote: I am not arguing that it is a generalised xor. I don’t want anything, I am just gauging if it is specialised or if there is a need for it. So just thought could suggest it as I have encountered such need several times already. It is

Re: xor operator

2023-11-13 Thread Michael Speer via Python-list
m the Latin exclusive or. On Mon, Nov 13, 2023 at 7:20 PM Grant Edwards via Python-list < python-list@python.org> wrote: > On 2023-11-13, Dom Grigonis via Python-list > wrote: > > > I am not asking. Just inquiring if the function that I described > > could be useful fo

Re: xor operator

2023-11-13 Thread Chris Angelico via Python-list
On Tue, 14 Nov 2023 at 11:29, Dom Grigonis via Python-list wrote: > > > > Except the 'any' and 'all' builtins are _exactly_ the same as bitwise > > or and and applided to many bits. To do something "in line" with that > > using the 

Re: xor operator

2023-11-13 Thread Dom Grigonis via Python-list
thing. DG > On 14 Nov 2023, at 02:33, Mats Wichmann via Python-list > wrote: > > On 11/13/23 16:24, Dom Grigonis via Python-list wrote: >> I am not arguing that it is a generalised xor. >> I don’t want anything, I am just gauging if it is specialised or if there is >

Re: xor operator

2023-11-13 Thread Chris Angelico via Python-list
On Tue, 14 Nov 2023 at 12:02, Dom Grigonis via Python-list wrote: > As I am here, I will dare to ask if there is no way that `sign` function is > going to be added to `math` or `builtins`. > https://docs.python.org/3/library/math.html#math.copysign ChrisA -- https://mail.python.or

Re: xor operator

2023-11-13 Thread Alan Gauld via Python-list
On 14/11/2023 00:33, Mats Wichmann via Python-list wrote: > Hardware and software people may have somewhat different views of xor I've come at it from both sides. I started life as a telecomms technician and we learned about xor in the context of switching and relays and xor was

Re: xor operator

2023-11-13 Thread Chris Angelico via Python-list
eo is well worth watching. More modern error correction systems are slightly different, but will still be built on many of the same principles. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: xor operator

2023-11-13 Thread Grant Edwards via Python-list
On 2023-11-14, Dom Grigonis via Python-list wrote: > >> Except the 'any' and 'all' builtins are _exactly_ the same as bitwise >> or and and applided to many bits. To do something "in line" with that >> using the 'xor' operator would ret

RE: xor operator

2023-11-13 Thread AVI GROSS via Python-list
other functions can easily be cobbled together. -----Original Message- From: Python-list On Behalf Of Grant Edwards via Python-list Sent: Monday, November 13, 2023 8:19 PM To: python-list@python.org Subject: Re: xor operator On 2023-11-14, Dom Grigonis via Python-list wrote: > >> Exc

Re: xor operator (DEPRECATED)

2023-11-13 Thread Dom Grigonis via Python-list
thoughts on this. DG > On 14 Nov 2023, at 04:27, AVI GROSS via Python-list > wrote: > > I was going to ask a dumb question. Has any other language you know of made > something available that does what is being asked for and included it in the > main program environment rat

RE: xor operator (DEPRECATED)

2023-11-13 Thread AVI GROSS via Python-list
’t require predicates. b) I welcome any thoughts on this. DG > On 14 Nov 2023, at 04:27, AVI GROSS via Python-list > wrote: > > I was going to ask a dumb question. Has any other language you know of made > something available that does what is being asked for and included it in the &

Re: xor operator (DEPRECATED)

2023-11-13 Thread Thomas Passin via Python-list
On 11/13/2023 11:44 PM, AVI GROSS via Python-list wrote: Dom, I hear you. As you say, writing your own extension in something like C++ may not appeal to you even if it is faster. I was wondering if using a generator or something similar in R might make sense. I mean what happens if you

Re: xor operator (DEPRECATED)

2023-11-13 Thread Dom Grigonis via Python-list
hon-list > wrote: > > On 11/13/2023 11:44 PM, AVI GROSS via Python-list wrote: >> Dom, >> I hear you. >> As you say, writing your own extension in something like C++ may not appeal >> to you even if it is faster. >> I was wondering if using a generator or s

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

2023-11-14 Thread Jacob Kruger via Python-list
.." On 2023/11/13 19:47, Barry wrote: 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

Code improvement question

2023-11-14 Thread Mike Dewhirst via Python-list
(bit) > 6 else "")     return " ".join(pieces) Many thanks for any hints Cheers Mike -- https://mail.python.org/mailman/listinfo/python-list

Re: Code improvement question

2023-11-14 Thread Mike Dewhirst via Python-list
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 in advance. After cleaning the

Newline (NuBe Question)

2023-11-14 Thread Grizzy Adams via Python-list
ere a way to get the newline in as I append to list? Thanks again -- https://mail.python.org/mailman/listinfo/python-list

Re: Newline (NuBe Question)

2023-11-15 Thread Alan Gauld via Python-list
On 15/11/2023 07:25, Grizzy Adams via Python-list wrote: > for s in students: > grades.append(s.school) > grades.append(s.name) > grades.append(s.finalGrade()) > if s.finalGrade()>82: >

Re: Newline (NuBe Question)

2023-11-15 Thread Cameron Simpson via Python-list
grades.append(s.name) grades.append(s.finalGrade()) if s.finalGrade()>82: grades.append("Pass") else: grades.append("Fail") print(grades) Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: xor operator

2023-11-15 Thread Dom Grigonis via Python-list
significantly slower. Regards, DG > On 15 Nov 2023, at 02:34, Peter J. Holzer via Python-list > wrote: > > On 2023-11-14 00:11:30 +0200, Dom Grigonis via Python-list wrote: >> Benchmarks: >> test1 = [False] * 100 + [True] * 2 >> test2 = [True] * 100 + [False] * 2 >

Re: Newline (NuBe Question)

2023-11-15 Thread Grizzy Adams via Python-list
Wednesday, November 15, 2023 at 9:50, Alan Gauld via Python-list wrote: Re: Newline (NuBe Question) (at least in part) >On 15/11/2023 07:25, Grizzy Adams via Python-list wrote: >> for s in students: >> grades.append(s.school) >>

Re: Newline (NuBe Question)

2023-11-15 Thread Thomas Passin via Python-list
On 11/15/2023 2:25 AM, Grizzy Adams via Python-list wrote: Hi & thanks for patience with what could be simple to you Have this (from an online "classes" tutorial) --- Start Code Snippit --- students = [] grades = [] for s in geographyClass: students.append(geographyStu

Re: Newline (NuBe Question)

2023-11-15 Thread Grizzy Adams via Python-list
Wednesday, November 15, 2023 at 9:45, Thomas Passin via Python-list wrote: Re: Newline (NuBe Question) (at least in part) >On 11/15/2023 2:25 AM, Grizzy Adams via Python-list wrote: >> Hi & thanks for patience with what could be simple to you >You may see responses that sugg

Re: Newline (NuBe Question)

2023-11-15 Thread Pierre Fortin via Python-list
On Wed, 15 Nov 2023 16:51:09 - Grizzy Adams via Python-list wrote: I don't give solutions; just a nudge... you appear not to fully grok "list"; your list is ONE list with no delineation between students. You want a "list of lists"... >['Example High'

Re: xor operator

2023-11-15 Thread Dom Grigonis via Python-list
, but it seems fairly probable to need `set() > n` and `set() < n`. Regards, DG > On 15 Nov 2023, at 19:16, Peter J. Holzer via Python-list > wrote: > > On 2023-11-15 12:26:32 +0200, Dom Grigonis wrote: >> >> Thank you, >> >> >> test2 = [True]

__set_name__ equivalent for instance

2023-11-15 Thread Dom Grigonis via Python-list
of attribute to receive `instance` argument on instance creation. Regards, DG -- https://mail.python.org/mailman/listinfo/python-list

Re: xor operator

2023-11-15 Thread Dom Grigonis via Python-list
here one would need `set() == n` is hard to think > of, but it seems fairly probable to need `set() > n` and `set() < n`. > > Regards, > DG > >> On 15 Nov 2023, at 19:16, Peter J. Holzer via Python-list >> mailto:python-list@python.org>> wrote: >> >>

Re: Newline (NuBe Question)

2023-11-15 Thread Grizzy Adams via Python-list
Wednesday, November 15, 2023 at 12:19, Pierre Fortin wrote: Re: Newline (NuBe Question) (at least in part) >On Wed, 15 Nov 2023 16:51:09 - Grizzy Adams via Python-list wrote: > >I don't give solutions; just a nudge... you appear not to fully grok >"list"; yo

Re: Newline (NuBe Question)

2023-11-15 Thread Thomas Passin via Python-list
On 11/15/2023 2:04 PM, Grizzy Adams via Python-list wrote: Wednesday, November 15, 2023 at 12:19, Pierre Fortin wrote: Re: Newline (NuBe Question) (at least in part) On Wed, 15 Nov 2023 16:51:09 - Grizzy Adams via Python-list wrote: I don't give solutions; just a nudge... you appea

Re: Newline (NuBe Question)

2023-11-15 Thread Grizzy Adams via Python-list
Wednesday, November 15, 2023 at 15:54, Thomas Passin via Python-list wrote: Re: Newline (NuBe Question) (at least in part) >On 11/15/2023 2:04 PM, Grizzy Adams via Python-list wrote: >> Wednesday, November 15, 2023 at 12:19, Pierre Fortin wrote: >> Re: Newline (NuBe Question) (a

Amy known issues with tkinter /ttk on latest MacOS?

2023-11-16 Thread Alan Gauld via Python-list
ow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos -- https://mail.python.org/mailman/listinfo/python-list

Re: Newline (NuBe Question)

2023-11-16 Thread Thomas Passin via Python-list
On 11/16/2023 1:19 AM, Grizzy Adams via Python-list wrote: Wednesday, November 15, 2023 at 15:54, Thomas Passin via Python-list wrote: Re: Newline (NuBe Question) (at least in part) On 11/15/2023 2:04 PM, Grizzy Adams via Python-list wrote: Wednesday, November 15, 2023 at 12:19, Pierre

Re: Newline (NuBe Question)

2023-11-16 Thread Grizzy Adams via Python-list
Thursday, November 16, 2023 at 7:47, Thomas Passin via Python-list wrote: Re: Newline (NuBe Question) (at least in part) >I wrote that you don't need the "students" list, which is correct. But >there could be a use for a list. It would let you change the order in >

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dom Grigonis via Python-list
e instance as parameter. > Note that descriptors are stored in the class: they must not store > instance specific information in their attributes. > Therefore, a method informing an descriptor about instance creation > would not help: it cannot do anything with it. -- https://mail.python.org/mailman/listinfo/python-list

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dieter Maurer via Python-list
rmation in their attributes. Therefore, a method informing an descriptor about instance creation would not help: it cannot do anything with it. -- https://mail.python.org/mailman/listinfo/python-list

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dieter Maurer via Python-list
ou would need a metaclass or `__inist_subclass__` is you want your "custom method binding" globally. For many methods (but usually not the `__...__` methods), you can take over the binding in `__new__` or `__init__` and populate the instance with prebound methods. -- https://mail.python.org/mailman/listinfo/python-list

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dom Grigonis via Python-list
at can be used on arbitrary methods. Needing to inherit and add metaclasses whenever I want to decorate is not an option. I think I will continue with descriptor approach and am slowly finding route to get where I need to, but still exploring options. Regards, DG -- https://mail.python.org/mailman/listinfo/python-list

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dieter Maurer via Python-list
e) are handled specially; functions are bound. Other objects are returned as is. `__getattribute__` can be used to take over control over the attribute access. -- https://mail.python.org/mailman/listinfo/python-list

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dom Grigonis via Python-list
> language reference. > > Functions and descriptors accessed via an instance but found in a class (i.e. > not directly in the instance) are handled specially; > functions are bound. Other objects are returned as is. > > `__getattribute__` can be used to take over control over the attribute > access. -- https://mail.python.org/mailman/listinfo/python-list

Re: Code improvement question

2023-11-16 Thread Mike Dewhirst via Python-list
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 like to improve the code below, which works. It feels clunky t

Re: Code improvement question

2023-11-16 Thread Rimu Atkinson via Python-list
erything. Or will be. I am doubtful. We'll see! R -- https://mail.python.org/mailman/listinfo/python-list

Re: Code improvement question

2023-11-16 Thread Mike Dewhirst via Python-list
On 16/11/2023 9:34 am, Rimu Atkinson via Python-list wrote: Why don't you use re.findall? re.findall(r'\b[0-9]{2,7}-[0-9]{2}-[0-9]{2}\b', txt) I think I can see what you did there but it won't make sense to me - or whoever looks at the code - in future. That a

Re: Code improvement question

2023-11-17 Thread Thomas Passin via Python-list
On 11/17/2023 6:17 AM, Peter J. Holzer via Python-list wrote: On 2023-11-16 11:34:16 +1300, Rimu Atkinson via Python-list wrote: Why don't you use re.findall? re.findall(r'\b[0-9]{2,7}-[0-9]{2}-[0-9]{2}\b', txt) I think I can see what you did there but it won't make sens

Re: Code improvement question

2023-11-17 Thread Thomas Passin via Python-list
On 11/17/2023 9:46 AM, Peter J. Holzer via Python-list wrote: On 2023-11-17 07:48:41 -0500, Thomas Passin via Python-list wrote: On 11/17/2023 6:17 AM, Peter J. Holzer via Python-list wrote: Oh, and Python (just like Perl) allows you to embed whitespace and comments into Regexps, which helps

RE: Code improvement question

2023-11-17 Thread AVI GROSS via Python-list
be interpreted at some point as 12 dozen, which may even be appropriate but a bit of a surprise perhaps. -Original Message- From: Python-list On Behalf Of Peter J. Holzer via Python-list Sent: Friday, November 17, 2023 6:18 AM To: python-list@python.org Subject: Re: Code improvement

Re: Amy known issues with tkinter /ttk on latest MacOS?

2023-11-19 Thread Alan Gauld via Python-list
inue nudging the mouse as I click! Alan G. -- https://mail.python.org/mailman/listinfo/python-list

Re: Code improvement question

2023-11-21 Thread Rimu Atkinson via Python-list
ward to me. I'll be impressed if you can write that in Python in a way which is easier to read. Now that I know what {} does, you're right, that IS straightforward! Maybe 2023 will be the year I finally get off my arse and learn regex. Thanks :) -- https://mail.python.org/mailman/listinfo/python-list

Python 3.13.0 alpha 2 now available.

2023-11-22 Thread Thomas Wouters via Python-list
asz Langa -- Thomas Wouters -- https://mail.python.org/mailman/listinfo/python-list

RE: Newline (NuBe Question)

2023-11-24 Thread AVI GROSS via Python-list
ch as some form of matrix or data.frame. And, yes, you can sort something like the above by name or GPA or number of credits taken but the point was responding to why bother making a list just to print it. The answer is that many and even most programs do a bit more than that and a good choice of da

Printing dict value for possibly undefined key

2023-11-25 Thread Loris Bennett via Python-list
;) Is there any more compact way of achieving the same thing? Cheers, Loris -- This signature is currently under constuction. -- https://mail.python.org/mailman/listinfo/python-list

Re: Printing dict value for possibly undefined key

2023-11-25 Thread duncan smith via Python-list
#x27;foo']} {d['bar']}") Is there any more compact way of achieving the same thing? Cheers, Loris Yes. e.g. d.get('foo', "NULL") Duncan -- https://mail.python.org/mailman/listinfo/python-list

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Rimu Atkinson via Python-list
5 (main, Oct 28 2022, 17:28:38) [GCC] on linux x = ('%' + "2023-11" + '%') x '%2023-11%' x = ('%' + x + '%',) x ('%%2023-11%%',) x.__class__.__name__ 'tuple' -- https://mail.python.org/mailman/listinfo/python-list

Re: Printing dict value for possibly undefined key

2023-11-25 Thread duncan smith via Python-list
="NULL"    print(f"{id} {d['foo']} {d['bar']}") Is there any more compact way of achieving the same thing? Cheers, Loris Yes. e.g. d.get('foo', "NULL") Duncan Or make d a defaultdict. from collections import defaultdict dic = defaultdict(lambda:'NULL') dic['foo'] = 'astring' dic['foo'] 'astring' dic['bar'] 'NULL' Duncan -- https://mail.python.org/mailman/listinfo/python-list

Silly/crazy problem with sqlite

2023-11-25 Thread Chris Green via Python-list
imo$ It's treating the "2023-11" plus % at each end as separate variables to the binding, this is crazy! I've done similar elsewhere and it works OK, what on earth am I doing wrong here? It has to be something very silly but I can't see it at the moment. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Chris Green via Python-list
say this seems very non-pythonesque to me, the 'obvious' default simply doesn't work right, and I really can't think of a case where the missing comma would make any sense at all. Maybe I've had too much to eat and drink tonight! :-) -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Sibylle Koczian via Python-list
Am 24.11.2023 um 22:49 schrieb Rimu Atkinson via Python-list: I really can't think of a case where the missing comma would make any sense at all. That is pretty tricky, yes. The comma means it's a tuple. Without the comma, it's just a string with parenthesis around

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Mats Wichmann via Python-list
On 11/24/23 14:10, Chris Green via Python-list wrote: Chris Green wrote: This is driving me crazy, I'm running this code:- OK, I've found what's wrong:- cr.execute(sql, ('%' + "2023-11" + '%')) should be:- cr.execute(sql, ('

Re: Printing dict value for possibly undefined key

2023-11-25 Thread DL Neil via Python-list
On 11/25/2023 3:31 AM, Loris Bennett via Python-list wrote: Hi, I want to print some records from a database table where one of the fields contains a JSON string which is read into a dict. I am doing something like print(f"{id} {d['foo']} {d['bar']}") How

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Thomas Passin via Python-list
On 11/24/2023 4:49 PM, Rimu Atkinson via Python-list wrote: I really can't think of a case where the missing comma would make any sense at all. That is pretty tricky, yes. The comma means it's a tuple. Without the comma, it's just a string with parenthesis around it, wh

Re: Silly/crazy problem with sqlite

2023-11-26 Thread Chris Green via Python-list
on, more that doing the obvious doesn't work which, in Python, it usually does in my experience. The error message could be a bit more helpful too, maybe one of those "... did you mean ?" ones could point one in the right direction. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Context without manager

2023-11-26 Thread Piergiorgio Sartor via Python-list
Question: is there any other way to use a context manager only object within a class, with methods accessing the object? Or any other solution to the same situation? Thanks a lot in advance. P.S.: currently gmail posts are deleted, due to excessive spam, so I'll not see any reply coming from this family of addresses. bye, -- piergiorgio -- https://mail.python.org/mailman/listinfo/python-list

Re: RE: Newline (NuBe Question)

2023-11-26 Thread Chris Angelico via Python-list
On Sun, 26 Nov 2023 at 21:08, Michael F. Stemper via Python-list wrote: > > On 24/11/2023 21.45, avi.e.gr...@gmail.com wrote: > > Grizz[l]y, > > > > I think the point is not about a sorted list or sorting in general It is > > about reasons why maintaining a data

Re: Newline (NuBe Question)

2023-11-26 Thread Roel Schroeven via Python-list
Michael F. Stemper via Python-list schreef op 25/11/2023 om 15:32: On 24/11/2023 21.45,avi.e.gr...@gmail.com wrote: > Grizz[l]y, > > I think the point is not about a sorted list or sorting in general It is > about reasons why maintaining a data structure such as a list in a prog

Re: Context without manager

2023-11-26 Thread Dieter Maurer via Python-list
) perform some operations in this context (--> body of `with` statement) tear down the context (--> method `__exit__`). If you do not have this case (e.g. usually if you open the file in a class's `__init__`), you do not use a context manager. -- https://mail.python.org/mailman/listinfo/python-list

RE: RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
, it makes sense to use the expanded language if it results in faster writing perhaps of faster code with fewer mistakes. -Original Message----- From: Python-list On Behalf Of Michael F. Stemper via Python-list Sent: Saturday, November 25, 2023 9:32 AM To: python-list@python.org Subject: Re: R

RE: RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
al Message----- From: Python-list On Behalf Of Chris Angelico via Python-list Sent: Sunday, November 26, 2023 6:49 AM To: python-list@python.org Subject: Re: RE: Newline (NuBe Question) On Sun, 26 Nov 2023 at 21:08, Michael F. Stemper via Python-list wrote: > > On 24/11/2023 21.45, avi.e.gr...

Re: Newline (NuBe Question)

2023-11-26 Thread DL Neil via Python-list
On 11/27/2023 12:48 AM, Chris Angelico via Python-list wrote: On Sun, 26 Nov 2023 at 21:08, Michael F. Stemper via Python-list wrote: On 24/11/2023 21.45, avi.e.gr...@gmail.com wrote: Grizz[l]y, I think the point is not about a sorted list or sorting in general It is about reasons why

Re: RE: Newline (NuBe Question)

2023-11-26 Thread Chris Angelico via Python-list
s variable name would make complete sense. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: Newline (NuBe Question)

2023-11-26 Thread DL Neil via Python-list
On 11/27/2023 1:08 AM, Roel Schroeven via Python-list wrote: I prefer namedtuples or dataclasses over tuples. They allow you to refer to their fields by name instead of index: student.gpa is much clearer than student[2], and makes it less likely to accidentally refer to the wrong field. +1

<    20   21   22   23   24   25   26   27   28   29   >