Re: [Python-Dev] PEP-498: Literal String Formatting

2015年8月12日 16:19:29 -0700

On 08/10/2015 04:05 PM, ISAAC J SCHWABACHER wrote:
I don't know about you, but I sure like this better than what you have:
code.putlines(f"""
static char {entry.doc_cname}[] = "{
 split_string_literal(escape_bytestring(docstr))}";
{ # nested!
f"""
#if CYTHON_COMPILING_IN_CPYTHON
 struct wrapperbase {entry.wrapperbase_cname};
#endif
""" if entry.is_special else ''}
{(lambda temp, argn: # my kingdom for a let!
f"""
for ({temp}=0; {temp}<PyTuple_GET_SIZE({argn}); {temp}++) {{
 PyObject *item = PyTuple_GET_ITEM({argn}, {temp});
}}""")(..., Naming.args_cname)}
{self.starstar_arg.entry.cname} =
 ({Naming.kwds_cname}) ? PyDict_Copy({Naming.kwds_cname})
 : PyDict_New();
if (unlikely(!{self.starstar_arg.entry.cname})) return {self.error_value()};
""")
What do others think of this PEP-498 sample? (The PEP-501 version looks pretty 
similar, so I omit it.)
Agh! My brain is hurting! ;)
No, I don't care for it at all.
--
~Ethan~
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to