Re: Context without manager

2023-11-27 Thread Richard Damon via Python-list
). Note, YOUR program must now make sure that the __exit__ function is called, and handle any exceptions that got thrown, and that ob and var are put somewhere you can access them at that later time. > On Nov 27, 2023, at 12:24 PM, Piergiorgio Sartor via Python-list > wrote: > > O

how to connect linux aws ec2 instance to windows local machine at my home using paramiko

2023-11-27 Thread Kashish Naqvi via Python-list
ose() if __name__ == "__main__": run_scripts() i used this but i am unable to know what ip address to use? -- https://mail.python.org/mailman/listinfo/python-list

Re: Context without manager

2023-11-27 Thread Piergiorgio Sartor via Python-list
class where the device is opened in the __init__() and used in some methods. Any ideas? bye, -- piergiorgio -- https://mail.python.org/mailman/listinfo/python-list

RE: Newline (NuBe Question)

2023-11-27 Thread AVI GROSS via Python-list
ble. Have to head out as this is already long enough. -Original Message- From: 'DL Neil' Sent: Monday, November 27, 2023 2:49 AM To: avi.e.gr...@gmail.com; python-list@python.org Subject: Re: Newline (NuBe Question) Avi, On 11/27/2023 4:15 PM, avi.e.gr...@gmail.com wrote: > Da

Re: argparse argument post-processing

2023-11-27 Thread Chris Angelico via Python-list
On Mon, 27 Nov 2023 at 22:31, Dom Grigonis via Python-list wrote: > > Hi all, > > I have a situation, maybe someone can give some insight. > > Say I want to have input which is comma separated array (e.g. > paths='path1,path2,path3') and convert it to the desired output - li

argparse argument post-processing

2023-11-27 Thread Dom Grigonis via Python-list
ideas appreciated, Regards, DG -- https://mail.python.org/mailman/listinfo/python-list

Re: Newline (NuBe Question)

2023-11-26 Thread 'DL Neil' via Python-list
nscious choice to) use the best tool for the job - but don't let bias cloud your judgement, don't take the ideas of the MD's nephew as 'Gospel', and DO design the way forward... -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: Context without manager

2023-11-26 Thread Greg Ewing via Python-list
f __init__(self): self.cm = device_open() self.device = self.cm.__enter__() # Other methods here for doing things with # self.device def close(self): self.cm.__exit__(None, None, None) -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Context without manager

2023-11-26 Thread Greg Ewing via Python-list
On 27/11/23 9:03 am, Stefan Ram wrote: Above, "have" is followed by another verb in "have been", so it should be eligible for a contraction there! Yes, "been" is the past participle of 'to be", so "I've been" is fine. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Context without manager

2023-11-26 Thread Grant Edwards via Python-list
On 2023-11-27, Grant Edwards via Python-list wrote: > On 2023-11-26, Dieter Maurer via Python-list wrote: > >> 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. > > He knows that. The OP wr

Re: Context without manager

2023-11-26 Thread Grant Edwards via Python-list
On 2023-11-26, Dieter Maurer via Python-list wrote: > 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. He knows that. The OP wrote that he wants to use that can _only_ be used by a context manager, but he

RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
components of an object but verify the validity of the contents or do logging or any number of other things. Using a list or tuple does nothing else. So if you need nothing else, they are often suitable and sometimes even preferable. -Original Message----- From: Python-list On Behalf Of D

Re: Newline (NuBe Question)

2023-11-26 Thread Chris Angelico via Python-list
On Mon, 27 Nov 2023 at 13:52, AVI GROSS via Python-list wrote: > Be that as it > may, and I have no interest in this topic, in the future I may use the ever > popular names of Primus, Secundus and Tertius and get blamed for using > Latin. > Imperious Prima flashes forth her

RE: Newline (NuBe Question)

2023-11-26 Thread AVI GROSS via Python-list
from the Latin word for news. Be that as it may, and I have no interest in this topic, in the future I may use the ever popular names of Primus, Secundus and Tertius and get blamed for using Latin. -Original Message- From: Python-list On Behalf Of DL Neil via Python-list Sent: Sunday, Novembe

Re: Newline (NuBe Question)

2023-11-26 Thread DL Neil via Python-list
On 11/27/2023 10:04 AM, Peter J. Holzer via Python-list wrote: On 2023-11-25 08:32:24 -0600, Michael F. Stemper via Python-list wrote: On 24/11/2023 21.45, avi.e.gr...@gmail.com wrote: Of course, for serious work, some might suggest avoiding constructs like a list of lists and switch to using

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

Re: RE: Newline (NuBe Question)

2023-11-26 Thread Chris Angelico via Python-list
iable 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 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: Newline (NuBe Question)

2023-11-26 Thread Peter J. Holzer via Python-list
On 2023-11-25 08:32:24 -0600, Michael F. Stemper via Python-list wrote: > On 24/11/2023 21.45, avi.e.gr...@gmail.com wrote: > > Of course, for serious work, some might suggest avoiding constructs like a > > list of lists and switch to using modules and data structures [...] >

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

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

Context without manager

2023-11-26 Thread Piergiorgio Sartor via Python-list
tion: 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: Silly/crazy problem with sqlite

2023-11-26 Thread Chris Green via Python-list
s 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

Re: RE: Newline (NuBe Question)

2023-11-26 Thread Michael F. Stemper via Python-list
ing Python_ -- Michael F. Stemper This sentence no verb. -- https://mail.python.org/mailman/listinfo/python-list

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, which is a string

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']}") However, the dict does

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, ('%' + x + '%',) ) I have to say this

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 it, which

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Chris Green via Python-list
' 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

Silly/crazy problem with sqlite

2023-11-25 Thread Chris Green via Python-list
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: Printing dict value for possibly undefined key

2023-11-25 Thread duncan smith via Python-list
y 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

Re: Silly/crazy problem with sqlite

2023-11-25 Thread Rimu Atkinson via Python-list
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
ing? Cheers, Loris Yes. e.g. d.get('foo', "NULL") Duncan -- https://mail.python.org/mailman/listinfo/python-list

Printing dict value for possibly undefined key

2023-11-25 Thread Loris Bennett via Python-list
s currently under constuction. -- https://mail.python.org/mailman/listinfo/python-list

RE: Newline (NuBe Question)

2023-11-24 Thread AVI GROSS via Python-list
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 data structure facilitates ... -Original Message-

FOSDEM 2024: Call for Proposals - Python Devrooom

2023-11-23 Thread Marc-Andre Lemburg via Python-list
and Marc-Andre Lemburg -- 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

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

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

Re: Code improvement question

2023-11-21 Thread Rimu Atkinson via Python-list
. 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

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

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

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: Code improvement question

2023-11-17 Thread jak via Python-list
://mail.python.org/mailman/listinfo/python-list

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

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

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 Peter J. Holzer via Python-list
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 readability a lot if you have to > &g

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 sense to me - or whoever

Re: Code improvement question

2023-11-17 Thread Peter J. Holzer via Python-list
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 sense to me - or &g

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 answers your specific

Re: Code improvement question

2023-11-16 Thread Rimu Atkinson via Python-list
oubtful. We'll see! R -- https://mail.python.org/mailman/listinfo/python-list

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 like

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

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dom Grigonis via Python-list
the > 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: __set_name__ equivalent for instance

2023-11-16 Thread Dieter Maurer via Python-list
tance) 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
that 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
, you 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 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 Dom Grigonis via Python-list
t the 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: 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 >wh

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

Amy known issues with tkinter /ttk on latest MacOS?

2023-11-16 Thread Alan Gauld via Python-list
://www.flickr.com/photos/alangauldphotos -- https://mail.python.org/mailman/listinfo/python-list

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

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 appear

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

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

__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
, 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]

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', 'Mary', 89.6

Re: xor operator

2023-11-15 Thread Peter J. Holzer via Python-list
| | | | h...@hjp.at |-- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" signature.asc Description: PGP signature -- https://mail.python.org/mailman/listinfo/python-list

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

2023-11-15 Thread Dom Grigonis via Python-list
to be 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 Cameron Simpson via Python-list
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: 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 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

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

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

Re: xor operator

2023-11-14 Thread Peter J. Holzer via Python-list
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 > > TIMER.repeat([ > lambda: xor(test1), # 0.0168 > lambda: xor(test2), # 0.0172 > lambda:

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 rare. Perhaps

Code improvement question

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

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
1/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 it to run as unde

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

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

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 return True for an odd num

Re: xor operator

2023-11-13 Thread Chris Angelico via Python-list
ching. 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 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 a wir

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 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 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 'xor' operator would ret

Re: xor operator

2023-11-13 Thread Michael Speer via Python-list
t 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 for more people. > > > > Which is:

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

Re: xor operator

2023-11-13 Thread Dom Grigonis via Python-list
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

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