Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Forty two.


devel / comp.lang.python / Re: Getty fully qualified class name from class object

SubjectAuthor
* Getty fully qualified class name from class objectIan Pilcher
`* Re: Getty fully qualified class name from class objectGreg Ewing
 `- Re: Getty fully qualified class name from class objectIan Pilcher

1
Getty fully qualified class name from class object

<mailman.245.1692715510.23016.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23915&group=comp.lang.python#23915

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: arequip...@gmail.com (Ian Pilcher)
Newsgroups: comp.lang.python
Subject: Getty fully qualified class name from class object
Date: Tue, 22 Aug 2023 09:45:05 -0500
Lines: 23
Message-ID: <mailman.245.1692715510.23016.python-list@python.org>
References: <3397987e-ad50-ed09-640f-e55965456ea2@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de X1sjmqmGZH6Tcp5WVpSO/AwHVj+OWjyVHfGwpL2P09Lg==
Cancel-Lock: sha1:6IGS4qLjB/25ZwsPmIx/xu3klbg= sha256:Oj0PJmozC5zBu3OdvUXVKQwwiO5vnvfk3qgOs2X/Vsk=
Return-Path: <arequipeno@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=Ub3NdnRH;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.024
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:name': 0.07;
'example:': 0.09; 'module.': 0.09; 'subject:class': 0.09;
'import': 0.15; "(i'm": 0.16; 'attributes': 0.16; 'message-
id:@gmail.com': 0.18; 'to:addr:python-list': 0.20; 'to:name
:python-list@python.org': 0.24; '>>>': 0.28; 'header:User-
Agent:1': 0.30; 'received:google.com': 0.34;
'from:addr:gmail.com': 0.35; "skip:' 10": 0.37; 'subject:from':
0.37; 'class': 0.37; 'neither': 0.39; 'qualified': 0.76; 'skip:=
70': 0.84; 'meets': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20221208; t=1692715508; x=1693320308;
h=content-transfer-encoding:subject:from:to:content-language
:user-agent:mime-version:date:message-id:from:to:cc:subject:date
:message-id:reply-to;
bh=N1oWhhRBz6vgcj9+fwqdC7+2ft7A2Nfl0MpXmHsdBNM=;
b=Ub3NdnRH27f9g8pvXFeCArBDlH5zdZodJ2LLYanfxKGSt9yN9bngoYxxNEQ3K9vvqF
sZVaiIhS/3iBxJ/tVHmGPJ31qEL3qPjpq6gT3E5A/0OLco43aiX6h2DzbwyRZPia9O9N
uyMzHlxwZoKh7WiSAzrsKGeaJ/K0zSAIzVf7w1S6RxjnBk+R45X3mHD71rApoUmr+ZHm
hIHWk8gxT99ie54FyWgru+2CPFnINsJsKIZHz4Gn7pDwRhstBJmaSWHTXdmS7vS1QE5s
vUFbfoEhYBkXgZR/s5p8l88ANvnTxtKGCy+zctEDsEh8s7+tzz+hCaXT3KGgO2RWX8y/
yCUA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20221208; t=1692715508; x=1693320308;
h=content-transfer-encoding:subject:from:to:content-language
:user-agent:mime-version:date:message-id:x-gm-message-state:from:to
:cc:subject:date:message-id:reply-to;
bh=N1oWhhRBz6vgcj9+fwqdC7+2ft7A2Nfl0MpXmHsdBNM=;
b=O0XEA3Cf2lpERzczvogITYH7hdQOp7elq/jY9dZ9AsmgXgta3iVWgSgkFDosjLGVHv
3L1KY6c+3WShGhKHQ8bbg13GrXIIqf/lT2e19+VfWu1FB1QYox+etSBVeESTgfSvUVRQ
wTxG85ScyqfhVj8ubF4iAplv0xl/YjJ6KRawBIunUfTp8ellqww3RDDhO22701YgZCHu
wE+RUe1K1Q75iDpKFfiRdA/+CCLci0VDjyHzlWoAJwecJpJqNQiiPXQ58yYI3UoXBBw9
31GZVgthjUlTIhEXhJeR6gdMJ8FgRm8tfnNoMX2FL71V4Q6gTCbcWFVPPFv54HaeFj/1
hgnA==
X-Gm-Message-State: AOJu0YwvdOAJ1ootBRBW2EtbDmQj3YkBYZHTELsIYgcrxNBX6U9GgVVE
pjJwziYPI6FoULDa6ra9rooWCtyi/+8=
X-Google-Smtp-Source: AGHT+IFOqhyM0ypolppH3rWStYL3zBKwoDKvBQ+dShDtO99oopxqUCXcZwJwfJYrkaNgAuWFYIjFLA==
X-Received: by 2002:a4a:e741:0:b0:56e:94ed:c098 with SMTP id
n1-20020a4ae741000000b0056e94edc098mr9263514oov.0.1692715507724;
Tue, 22 Aug 2023 07:45:07 -0700 (PDT)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Content-Language: en-US
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <3397987e-ad50-ed09-640f-e55965456ea2@gmail.com>
 by: Ian Pilcher - Tue, 22 Aug 2023 14:45 UTC

How can I programmatically get the fully qualified name of a class from
its class object? (I'm referring to the name that is shown when str()
or repr() is called on the class object.)

Neither the __name__ or __qualname__ class attributes include the
module. For example:

>>> import logging

>>> str(logging.Handler)
"<class 'logging.Handler'>"

>>> logging.Handler.__name__
'Handler'
>>> logging.Handler.__qualname__
'Handler'

How can I programmatically get 'logging.Handler' from the class object?

--
========================================================================
Google Where SkyNet meets Idiocracy
========================================================================

Re: Getty fully qualified class name from class object

<kkk54lFhr37U1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23916&group=comp.lang.python#23916

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: Getty fully qualified class name from class object
Date: Wed, 23 Aug 2023 04:13:08 +1200
Lines: 12
Message-ID: <kkk54lFhr37U1@mid.individual.net>
References: <3397987e-ad50-ed09-640f-e55965456ea2@gmail.com>
<mailman.245.1692715510.23016.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net vb3iYceGn5DLKZ5xTyUU5A/8MGFOq3sxFzSWpFLkimoAsKwZdm
Cancel-Lock: sha1:R9qQ6cyVR4H/HaTREZODK2xcuH8= sha256:sIaq+sexB4HHf9wc2EeVk3mBze7MYPscYGq2YqdUYKg=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:91.0)
Gecko/20100101 Thunderbird/91.3.2
Content-Language: en-US
In-Reply-To: <mailman.245.1692715510.23016.python-list@python.org>
 by: Greg Ewing - Tue, 22 Aug 2023 16:13 UTC

On 23/08/23 2:45 am, Ian Pilcher wrote:
> How can I programmatically get 'logging.Handler' from the class object?

Classes have a __module__ attribute:

>>> logging.Handler.__module__
'logging'

--
Greg

Re: Getty fully qualified class name from class object

<mailman.249.1692817549.23016.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23920&group=comp.lang.python#23920

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: arequip...@gmail.com (Ian Pilcher)
Newsgroups: comp.lang.python
Subject: Re: Getty fully qualified class name from class object
Date: Wed, 23 Aug 2023 14:05:44 -0500
Lines: 16
Message-ID: <mailman.249.1692817549.23016.python-list@python.org>
References: <3397987e-ad50-ed09-640f-e55965456ea2@gmail.com>
<mailman.245.1692715510.23016.python-list@python.org>
<kkk54lFhr37U1@mid.individual.net>
<9f0424cd-ac13-2edc-dd48-67c0bf297342@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de Mk4UvuCxLCcM+ybyCNZqDAXHXiaWJplcyqx6HKOjW/rg==
Cancel-Lock: sha1:LccgsDA6SrjZQHBtsUlcmiCOLpM= sha256:UYsTKYABkonQa5ea3lko3X5qZAM17XNqEyviKXltl3A=
Return-Path: <arequipeno@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=Kr8aOpuH;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.018
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'looks': 0.02;
'subject:name': 0.07; 'thing.': 0.07; 'subject:class': 0.09;
'greg': 0.16; 'wrote:': 0.16; 'message-id:@gmail.com': 0.18;
'to:addr:python-list': 0.20; 'thanks!': 0.24; 'classes': 0.26;
'>>>': 0.28; 'header:User-Agent:1': 0.30; 'think': 0.32; 'python-
list': 0.32; "didn't": 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'subject:from': 0.37; "it's": 0.37; 'look': 0.65; 'skip:f 30':
0.71; 'skip:= 70': 0.84; 'meets': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20221208; t=1692817546; x=1693422346;
h=content-transfer-encoding:in-reply-to:from:references:newsgroups:to
:content-language:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=JUoDdGjFiJZPL3A4r1bIwSmijAus94+LNPjufzwUfyo=;
b=Kr8aOpuHA/3mu9ZYms3IJvyqXNcRmEAds0tbJFhJybvFnuF9V1F1xZDszH9Io2n+Kf
DWWRxMT4XSgJr/Zb9m3E+QqNyESb/7KwilFAEyMMkPHwZbwpScSklzBVX6TzzEoqtsWd
wm7thYbkwUw9+mUNrQopaNLY2lK8QSkwFJ69LvWyRGlT1JQRKieWaADRGgdUBKz8nItk
oRHGiqaeDz2hyE3MeilIdzDWzJNeLEXxGrGste5bjBQ/rpS8hbSYKpxhLFNQtsW94fmw
5PDQkZfE3VTXtAcFTMb3foCMhY3+W9iyJKXM2SxHCWAKUg1hC+AQcASazxSEe6bPF+om
Lndg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20221208; t=1692817546; x=1693422346;
h=content-transfer-encoding:in-reply-to:from:references:newsgroups:to
:content-language:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=JUoDdGjFiJZPL3A4r1bIwSmijAus94+LNPjufzwUfyo=;
b=Zf2fiVgpSVeFbsbKY/7FRS6vZ/cu+9Qyu85w7QrGXgI0VloM3PHls3okyfn44LL3K5
p/juBMs8U6b75ExWE2aoaGz1Jd6OG8ZwaO/V1ZAvUFfpeLvui1Zaza967gncDt7fCDsn
fS8YsIFwI6hyhRYHmXElf8PsKrcs1uIO8orxUc6H1BpDfGAyhxQtewFx+F4TgK7jKMrT
EK21lc6+PP6qLSwigklnwC++5OFruaXZwwhw/liMxWmdi5J3RmfPWbTONb0HNFL7IRYT
dnFi11wQmu3RWu/HFyPVXjiCduqnibhEV6NCQHo7YCZ9YL3NKmL3aAQ5VY8f0Dv0R3pA
pU0A==
X-Gm-Message-State: AOJu0YxqKqMwZCFPywMIf4Em8kF+nBuYB3cqcBWrnCDeaYJoc4qWUbTB
mar5oUi1syeFhgl7c8FePhM=
X-Google-Smtp-Source: AGHT+IHEpkvMXjxyLlKxGPmY6Un++rw2duUvBarY09XpaRm7mxkmA7bsGvY3pR4tSqw9nmlDM6/g0w==
X-Received: by 2002:a4a:c3c8:0:b0:56e:487f:8caa with SMTP id
e8-20020a4ac3c8000000b0056e487f8caamr12967522ooq.1.1692817546130;
Wed, 23 Aug 2023 12:05:46 -0700 (PDT)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.13.0
Content-Language: en-US
In-Reply-To: <kkk54lFhr37U1@mid.individual.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <9f0424cd-ac13-2edc-dd48-67c0bf297342@gmail.com>
X-Mailman-Original-References: <3397987e-ad50-ed09-640f-e55965456ea2@gmail.com>
<mailman.245.1692715510.23016.python-list@python.org>
<kkk54lFhr37U1@mid.individual.net>
 by: Ian Pilcher - Wed, 23 Aug 2023 19:05 UTC

On 8/22/23 11:13, Greg Ewing via Python-list wrote:
> Classes have a __module__ attribute:
>
> >>> logging.Handler.__module__
> 'logging'

Not sure why I didn't think to look for such a thing. Looks like it's
as simple as f'{cls.__module__}.{cls.__qualname__}'.

Thanks!

--
========================================================================
Google Where SkyNet meets Idiocracy
========================================================================

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor