Re: Dealing with non-callable classmethod objects

2022-11-11 Thread Dieter Maurer
Ian Pilcher wrote at 2022-11-11 15:29 -0600: > ... >In searching, I've found a few articles that discuss the fact that >classmethod objects aren't callable, but the situation actually seems to >be more complicated. > > >>> type(DuidLLT._parse_l2addr) > > >>> callable(DuidLLT._parse_l2addr) >True >

Re: Strange UnicodeEncodeError in Windows image on Azure DevOps and Github

2022-11-11 Thread Inada Naoki
On Sat, Nov 12, 2022 at 11:53 AM Inada Naoki wrote: > > On Sat, Nov 12, 2022 at 10:21 AM 12Jessicasmith34 > <12jessicasmit...@gmail.com> wrote: > > > > > > Two questions: any idea why this would be happening in this situation? > > AFAIK, stdout *is* a console when these images are running the pyt

Re: Strange UnicodeEncodeError in Windows image on Azure DevOps and Github

2022-11-11 Thread Inada Naoki
On Sat, Nov 12, 2022 at 10:21 AM 12Jessicasmith34 <12jessicasmit...@gmail.com> wrote: > > > Two questions: any idea why this would be happening in this situation? AFAIK, > stdout *is* a console when these images are running the python process. > Second - is there a way I can check the locale and

Re: Need max values in list of tuples, based on position

2022-11-11 Thread DFS
On 11/11/2022 7:04 PM, Dennis Lee Bieber wrote: On Fri, 11 Nov 2022 15:03:49 -0500, DFS declaimed the following: Thanks for looking at it. I'm trying to determine the maximum length of each column result in a SQL query. Normally you can use the 3rd value of the cursor.description object (se

Re: Strange UnicodeEncodeError in Windows image on Azure DevOps and Github

2022-11-11 Thread Eryk Sun
On 11/11/22, 12Jessicasmith34 <12jessicasmit...@gmail.com> wrote: > > any idea why this would be happening in this situation? AFAIK, stdout > *is* a console when these images are running the python process. If sys.std* are console files, then in Python 3.6+, sys.std*.buffer.raw will be _io._Window

Re: Strange UnicodeEncodeError in Windows image on Azure DevOps and Github

2022-11-11 Thread 12Jessicasmith34
> If stdout isn't a console (e.g. a pipe), it defaults to using the process code page (i.e. CP_ACP), such as legacy code page 1252 (extended Latin-1). First off, really helpful information, thank you. That was the exact background I was missing. Two questions: any idea why this

Re: Create a Python Launcher on Desktop

2022-11-11 Thread Eryk Sun
On 11/11/22, ohins...@gmail.com wrote: > > I am real a beginner of Python. Not able to create a Python launcher > (shortcut) on Desktop after the installation. Did you already install Python? If not, open the Store, and install the Python 3.11 app that's published by the Python Software Foundati

Re: Superclass static method name from subclass

2022-11-11 Thread Thomas Passin
On 11/11/2022 5:07 PM, Ian Pilcher wrote: On 11/11/22 11:02, Thomas Passin wrote: You can define a classmethod in SubClass that seems to do the job: class SuperClass(object):    @staticmethod    def spam():  # "spam" and "eggs" are a Python tradition    print('spam from SuperCla

Re: Create a Python Launcher on Desktop

2022-11-11 Thread Thomas Passin
On 11/11/2022 4:44 PM, ohins...@gmail.com wrote: Hello, I am real a beginner of Python. Not able to create a Python launcher (shortcut) on Desktop after the installation. Would you kindly instruct how to do it? Windows 11-Home, 64 bits, HP desktop If you get an offer of Python wh

Re: Need max values in list of tuples, based on position

2022-11-11 Thread Dennis Lee Bieber
On Fri, 11 Nov 2022 15:03:49 -0500, DFS declaimed the following: >Thanks for looking at it. I'm trying to determine the maximum length of >each column result in a SQL query. Normally you can use the 3rd value >of the cursor.description object (see the DB-API spec), but apparently >not with

Re: Strange UnicodeEncodeError in Windows image on Azure DevOps and Github

2022-11-11 Thread Eryk Sun
On 11/10/22, Jessica Smith <12jessicasmit...@gmail.com> wrote: > > Weird issue I've found on Windows images in Azure Devops Pipelines and > Github actions. Printing Unicode characters fails on these images because, > for some reason, the encoding is mapped to cp1252. What is particularly > weird ab

Re: Need max values in list of tuples, based on position

2022-11-11 Thread Pancho via Python-list
On 11/11/2022 20:58, Thomas Passin wrote: On 11/11/2022 2:22 PM, Pancho via Python-list wrote: On 11/11/2022 18:53, DFS wrote: On 11/11/2022 12:49 PM, Dennis Lee Bieber wrote: On Fri, 11 Nov 2022 02:22:34 -0500, DFS declaimed the following: [(0,11), (1,1),  (2,1),   (0,1) , (1,41), (2,2),

Re: Need max values in list of tuples, based on position

2022-11-11 Thread DFS
On 11/11/2022 2:22 PM, Pancho wrote: On 11/11/2022 18:53, DFS wrote: On 11/11/2022 12:49 PM, Dennis Lee Bieber wrote: On Fri, 11 Nov 2022 02:22:34 -0500, DFS declaimed the following: [(0,11), (1,1),  (2,1),   (0,1) , (1,41), (2,2),   (0,9) , (1,3),  (2,12)] The set of values in elements[0]

Create a Python Launcher on Desktop

2022-11-11 Thread ohinseok
Hello, I am real a beginner of Python. Not able to create a Python launcher (shortcut) on Desktop after the installation. Would you kindly instruct how to do it? Windows 11-Home, 64 bits, HP desktop Thanks, Dan -- https://mail.python.org/mailman/listinfo/python-list

Re: Need max values in list of tuples, based on position

2022-11-11 Thread Thomas Passin
On 11/11/2022 2:22 AM, DFS wrote: [(0,11), (1,1),  (2,1),  (0,1) , (1,41), (2,2),  (0,9) , (1,3),  (2,12)] The set of values in elements[0] is {0,1,2} I want the set of max values in elements[1]: {11,41,12} This request is ambiguous. Do you want to get the maximum value for each row, and

Re: Dealing with non-callable classmethod objects

2022-11-11 Thread Cameron Simpson
On 11Nov2022 15:29, Ian Pilcher wrote: I am trying to figure out a way to gracefully deal with uncallable classmethod objects. I'm just going to trim your example below a bit for reference purposes: class DUID(object): def __init__(self, d): for attr, factory in self._attrs.items()

Re: Superclass static method name from subclass

2022-11-11 Thread Cameron Simpson
On 12Nov2022 09:17, Cameron Simpson wrote: On 11Nov2022 10:21, Ian Pilcher wrote: class SubClass(SuperClass): bar = SuperClass.foo ^^ Is there a way to do this without specifically naming 'SuperClass'? I think not. Then I saw your "Dealing with non-callable classmeth

Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-11 Thread Eryk Sun
On 11/11/22, darkst...@o2online.de wrote: > > What can I do for the next step to find, why IDLE isn’t working? The question is why tkinter isn't working. IDLE not working is just a symptom of the underlying problem. In the command prompt, run 32-bit Python 3.10 via `py -3.10-32`. In Python's inte

Re: Superclass static method name from subclass

2022-11-11 Thread Cameron Simpson
On 11Nov2022 10:21, Ian Pilcher wrote: Is it possible to access the name of a superclass static method, when defining a subclass attribute, without specifically naming the super- class? Contrived example: class SuperClass(object): @staticmethod def foo(): pass class SubCl

Re: Superclass static method name from subclass

2022-11-11 Thread Ian Pilcher
On 11/11/22 11:02, Thomas Passin wrote: You can define a classmethod in SubClass that seems to do the job: class SuperClass(object):   @staticmethod   def spam():  # "spam" and "eggs" are a Python tradition   print('spam from SuperClass') class SubClass(SuperClass):     @cla

Re: Argument name should be lowercase

2022-11-11 Thread dn
Thanks for the thoughts! On 11/11/2022 21.54, dn wrote: PyCharm is warning against using an identifier of all upper-case letters as a function's parameter, saying "Argument name should be lowercase". (weak, code smell) ... PEP-008: makes no mention, and is but a guide anyway. (that said, if

Re: Superclass static method name from subclass

2022-11-11 Thread Ian Pilcher
On 11/11/22 11:29, Dieter Maurer wrote: Ian Pilcher wrote at 2022-11-11 10:21 -0600: class SuperClass(object): @staticmethod def foo(): pass class SubClass(SuperClass): bar = SuperClass.foo ^^ Is there a way to do this without specifi

Re: Need max values in list of tuples, based on position

2022-11-11 Thread Thomas Passin
On 11/11/2022 2:22 PM, Pancho via Python-list wrote: On 11/11/2022 18:53, DFS wrote: On 11/11/2022 12:49 PM, Dennis Lee Bieber wrote: On Fri, 11 Nov 2022 02:22:34 -0500, DFS declaimed the following: [(0,11), (1,1),  (2,1),   (0,1) , (1,41), (2,2),   (0,9) , (1,3),  (2,12)] The set of value

Dealing with non-callable classmethod objects

2022-11-11 Thread Ian Pilcher
I am trying to figure out a way to gracefully deal with uncallable classmethod objects. The class hierarchy below illustrates the issue. (Unfortunately, I haven't been able to come up with a shorter example.) import datetime class DUID(object): _subclasses = {} def __init_subclass__

Re: Argument name should be lowercase

2022-11-11 Thread Chris Angelico
On Sat, 12 Nov 2022 at 06:42, Stefan Ram wrote: > > "Weatherby,Gerard" writes: > >I'd personally find it weird to see an all-cap parameter > > In the source code of the standard library, all-caps > notation is used for a parameter name sometimes > if that parameter name is "URL" or sometime

Re: Need max values in list of tuples, based on position

2022-11-11 Thread DFS
On 11/11/2022 7:50 AM, Stefan Ram wrote: Pancho writes: def build_max_dict( tups): dict = {} for (a,b) in tups: if (a in dict): if (b>dict[a]): dict[a]=b else: dict[a]=b return(sorted(dict.values())) Or, import it

Re: Need max values in list of tuples, based on position

2022-11-11 Thread Dennis Lee Bieber
On Fri, 11 Nov 2022 02:22:34 -0500, DFS declaimed the following: > >[(0,11), (1,1), (2,1), > (0,1) , (1,41), (2,2), > (0,9) , (1,3), (2,12)] > >The set of values in elements[0] is {0,1,2} > >I want the set of max values in elements[1]: {11,41,12} Do they have to be IN THAT OR

Re: Need max values in list of tuples, based on position

2022-11-11 Thread Pancho via Python-list
On 11/11/2022 07:22, DFS wrote: [(0,11), (1,1),  (2,1),  (0,1) , (1,41), (2,2),  (0,9) , (1,3),  (2,12)] The set of values in elements[0] is {0,1,2} I want the set of max values in elements[1]: {11,41,12} def build_max_dict( tups): dict = {} for (a,b) in tups: if (a in di

Re: Need max values in list of tuples, based on position

2022-11-11 Thread Pancho via Python-list
On 11/11/2022 18:53, DFS wrote: On 11/11/2022 12:49 PM, Dennis Lee Bieber wrote: On Fri, 11 Nov 2022 02:22:34 -0500, DFS declaimed the following: [(0,11), (1,1),  (2,1),   (0,1) , (1,41), (2,2),   (0,9) , (1,3),  (2,12)] The set of values in elements[0] is {0,1,2} I want the set of max val

Need max values in list of tuples, based on position

2022-11-11 Thread DFS
[(0,11), (1,1), (2,1), (0,1) , (1,41), (2,2), (0,9) , (1,3), (2,12)] The set of values in elements[0] is {0,1,2} I want the set of max values in elements[1]: {11,41,12} -- https://mail.python.org/mailman/listinfo/python-list

Re: Need max values in list of tuples, based on position

2022-11-11 Thread DFS
On 11/11/2022 12:49 PM, Dennis Lee Bieber wrote: On Fri, 11 Nov 2022 02:22:34 -0500, DFS declaimed the following: [(0,11), (1,1), (2,1), (0,1) , (1,41), (2,2), (0,9) , (1,3), (2,12)] The set of values in elements[0] is {0,1,2} I want the set of max values in elements[1]: {11,41,12}

Re: What is the reason from different output generate using logical 'and' and 'or' operator in Python 3.10.8

2022-11-11 Thread Exam Guide Publishers
On Tuesday, 8 November 2022 at 05:36:49 UTC+5:30, David wrote: > On Tue, 8 Nov 2022 at 03:08, ICT Ezy wrote: > > > Please explain how to generate different output in following logical > > operations > > > >>> 0 and True > > 0 > > >>> 0 or True > > True > > >>> 1 and True > > True > > >>

Strange UnicodeEncodeError in Windows image on Azure DevOps and Github

2022-11-11 Thread Jessica Smith
Hello, Weird issue I've found on Windows images in Azure Devops Pipelines and Github actions. Printing Unicode characters fails on these images because, for some reason, the encoding is mapped to cp1252. What is particularly weird about the code page being set to 1252 is that if you execute "chcp"

Re: Superclass static method name from subclass

2022-11-11 Thread Dieter Maurer
Ian Pilcher wrote at 2022-11-11 10:21 -0600: >Is it possible to access the name of a superclass static method, when >defining a subclass attribute, without specifically naming the super- >class? > >Contrived example: > > class SuperClass(object): > @staticmethod > def foo(): >

Re: Superclass static method name from subclass

2022-11-11 Thread Thomas Passin
You can define a classmethod in SubClass that seems to do the job: class SuperClass(object): @staticmethod def spam(): # "spam" and "eggs" are a Python tradition print('spam from SuperClass') class SubClass(SuperClass): @classmethod def eggs(self): super().

Re: Superclass static method name from subclass

2022-11-11 Thread Lars Liedtke
yes, just use SubClass.foo at least this works for me: class SuperClass: @staticmethod def test(): print("yay") class SubClass(SuperClass): def __init__(self): super().__init__() SubClass.test() subclass = SubClass() Output: python3.11 test.py yay

Re: Argument name should be lowercase

2022-11-11 Thread Weatherby,Gerard
If you wanted to document/enforce the input argument is immutable, you could do one of the following. You’d get a type warning in PyCharm with bad_func or equivalent, and bad_func2 will fail at runtime. def bad_func(x: typing.Mapping): """Get type warning if x modified""" x[3] = 7 def

Superclass static method name from subclass

2022-11-11 Thread Ian Pilcher
Is it possible to access the name of a superclass static method, when defining a subclass attribute, without specifically naming the super- class? Contrived example: class SuperClass(object): @staticmethod def foo(): pass class SubClass(SuperClass): bar = SuperCl

Re: Argument name should be lowercase

2022-11-11 Thread MRAB
On 2022-11-11 08:54, dn wrote: [snip] The module's function definition is: def build_product_prices_dictionary( WORKBOOK_DEFINITIONS:dict )->dict: ... price_array = xl.iget_array( file_name=WORKBOOK_DEFINITIONS[ "file_name" ], ... (the function def is flagged, as abov

Re: Argument name should be lowercase

2022-11-11 Thread Thomas Passin
This is a matter of convention. Historically, many language practitioners got used to using all-caps for key constants. This makes it easier to tell when you are using (or misusing) one, for one thing. For myself, I also will use all-caps for quasi-constants, ones that are set only once, for

Re: Argument name should be lowercase

2022-11-11 Thread Weatherby,Gerard
PEP 8 doesn’t explicitly list a naming convention for function parameters, but every example shows them as lowercase, even though the function doesn’t modify them. See also the Python tutorial ( https://docs.python.org/3/tutorial/controlflow.html#defining-functions ), which also shows all para

Argument name should be lowercase

2022-11-11 Thread dn
PyCharm is warning against using an identifier of all upper-case letters as a function's parameter, saying "Argument name should be lowercase". (weak, code smell) The application consists of three+ files: - configuration - mainline script - module of workbook functions The mainline reads the