Re: Checking That Two Args Are Of Same Type (Posting On Python-List Prohibited)

Liste des GroupesRevenir à cl python 
Sujet : Re: Checking That Two Args Are Of Same Type (Posting On Python-List Prohibited)
De : no.email (at) *nospam* nospam.invalid (Paul Rubin)
Groupes : comp.lang.python
Date : 23. Jun 2024, 09:00:29
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <871q4ota7m.fsf@nightsong.com>
References : 1
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
Consider a function taking two args “a” and “b”, which can be of str,
bytes or bytearray type, just so long as both are of the same type.
One easy way to test this is

if type(a)==type(b) and type(a) in (str, bytes, bytearray): ...

Date Sujet#  Auteur
23 Jun 24 * Checking That Two Args Are Of Same Type (Posting On Python-List Prohibited)5Lawrence D'Oliveiro
23 Jun 24 +- Re: Checking That Two Args Are Of Same Type (Posting On Python-List Prohibited)1Keith Thompson
23 Jun 24 +* Re: Checking That Two Args Are Of Same Type (Posting On Python-List Prohibited)2Paul Rubin
23 Jun 24 i`- Re: Checking That Two Args Are Of Same Type (Posting On Python-List Prohibited)1Lawrence D'Oliveiro
24 Jun 24 `- Re: Checking That Two Args Are Of Same Type (Posting On Python-List Prohibited)1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal