| Deutsch English Français Italiano |
|
<87ttf148ay.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Python (was Re: I did not inhale)
Date: Fri, 30 Aug 2024 21:37:09 -0700
Organization: None to speak of
Lines: 44
Message-ID: <87ttf148ay.fsf@nosuchdomain.example.com>
References: <uu54la$3su5b$6@dont-email.me> <va5ec2$3vluh$1@dont-email.me>
<va6q4g$c1a7$1@dont-email.me> <va6rpa$c6bg$1@dont-email.me>
<va6se9$cb8e$1@dont-email.me> <20240826083330.00004760@gmail.com>
<vaises$2k7o6$2@dont-email.me> <20240826155113.000005ba@gmail.com>
<wwvo75eicla.fsf@LkoBDZeT.terraraq.uk> <vak9k9$2ujrs$1@dont-email.me>
<valgpu$34s18$1@dont-email.me>
<87y14hd4bk.fsf@nosuchdomain.example.com>
<valnei$35rt8$2@dont-email.me>
<87ikvlcs7i.fsf@nosuchdomain.example.com>
<vamclm$3c4ke$1@dont-email.me>
<87ttf4bdcx.fsf@nosuchdomain.example.com>
<vaoaak$3l470$3@dont-email.me>
<875xrkb2iq.fsf@nosuchdomain.example.com>
<vaoibg$3m9tm$2@dont-email.me>
<87seuo9ikl.fsf@nosuchdomain.example.com>
<vatlvc$mhl0$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sat, 31 Aug 2024 06:37:12 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="78f6e35217d9802ff674987bcdbe52ec";
logging-data="931453"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+80/evwMXGCGu0YsUIdScA"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:yBaTVxgHwJ+Ghbxqb9s+RTmtrS0=
sha1:o03aDOVQ+rhJQ2m3QxNiKUL9Zig=
Bytes: 3534
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
> On Wed, 28 Aug 2024 19:19:38 -0700, Keith Thompson wrote:
>> My impression is that your unconventional style indicates a relative
>> lack of experience in Python.
>
> You think maybe I should practise by writing more Python code?
And you snipped the part where I acknowledged that might be an invalid
conclusion. I have no opinion on what you should do.
> OK, how about your thoughts on comparing this
>
> for attrname in obj.tag_attrs :
> attr = getattr(obj, attrname)
> if attr != None :
> if isinstance(attr, enum.Enum) :
> attr = attr.value
> elif isinstance(attr, Type) :
> attr = unparse_signature(attr)
> elif not isinstance(attr, str) :
> raise TypeError("unexpected attribute type %s for %s" % (type(attr).__name__, repr(attr)))
> attrs.append("%s=%s" % (attrname, quote_xml_attr(attr)))
> out.write(" " * indent + "<" + tag_name)
>
> with this
>
> for attrname in obj.tag_attrs :
> attr = getattr(obj, attrname)
> if attr != None :
> if isinstance(attr, enum.Enum) :
> attr = attr.value
> elif isinstance(attr, Type) :
> attr = unparse_signature(attr)
> elif not isinstance(attr, str) :
> raise TypeError("unexpected attribute type %s for %s" % (type(attr).__name__, repr(attr)))
> attrs.append("%s=%s" % (attrname, quote_xml_attr(attr)))
> out.write(" " * indent + "<" + tag_name)
The difference is obvious: the second calls attrs.append() even if attr
is None. I don't know what point you're trying to make.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */