updated pre-PEP: The create statement
Steven Bethard
steven.bethard at gmail.com
Thu Apr 6 12:34:22 EDT 2006
Michele Simionato wrote:
> Steven Bethard wrote:
>> I've updated the PEP based on a number of comments on comp.lang.python.
>> The most updated versions are still at:
>>
>> http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt
>> http://ucsu.colorado.edu/~bethard/py/pep_create_statement.html
>>
>> In this post, I'm especially soliciting review of Carl Banks's point
>> (now discussed under Open Issues) which asks if it would be better to
>> have the create statement translated into:
>>
>> <name> = <callable>("<name>", *<tuple>, **<namespace>)
>>
>> instead of the current:
>>
>> <name> = <callable>("<name>", <tuple>, <namespace>)
>>
>> The former allows the create statement to be applied to a wider variety
>> of callables; the latter keeps a better parallel with the class statement.
>
> Maybe I am thick this evening, but how that would work? It would break
> for
> classes if we do not follow the signature of 'type'. -1 unless you
> explain me
> what I am missing.
Yep, it would break for classes. The question is, what are the primary
use cases? If we believe this is just a replacement for classes, then
clearly the original translation is more appropriate. However, at the
moment, I don't think too many people are going to start replacing their
class statements with ``create type`` statements. So the create
statement doesn't have to be fully compatible with class statements.
I guess another way of asking the question is, are there existing
callables that could be used now with the (name, *args, **kwargs)
signature that couldn't be used with the (name, args, kwargs) signature?
If there are existing callables that could be immediately useful in a
create statement with no changes to their signature, then maybe it would
be better to cater to those. I'm not yet convinced that there are enough
such callables, but I'm willing to be convinced.
There were some errors in my Open Issues discussion of this. I've fixed
them:
http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt
http://ucsu.colorado.edu/~bethard/py/pep_create_statement.html
STeVe
More information about the Python-list
mailing list