Liste des Groupes | Revenir à cl misc |
Lawrence D'Oliveiro <ldo@nz.invalid> writes:Was it? I was convinced he'd posted exactly the same code by mistake, even though my brain told me there something that about them that didn't match. It took me nearly a minute to spot the difference.On Wed, 28 Aug 2024 19:19:38 -0700, Keith Thompson wrote:And you snipped the part where I acknowledged that might be an invalidMy 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?
conclusion. I have no opinion on what you should do.
OK, how about your thoughts on comparing thisThe difference is obvious: the second calls attrs.append() even if attr
>
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)
is None. I don't know what point you're trying to make.
Les messages affichés proviennent d'usenet.