[Python-Dev] cpython: move specialized dir implementations into dir methods (closes #12166) (original) (raw)
Benjamin Peterson benjamin at python.org
Tue May 24 19:39:57 CEST 2011
- Previous message: [Python-Dev] cpython: move specialized dir implementations into __dir__ methods (closes #12166)
- Next message: [Python-Dev] [pyodbc] Setting values to SQL_* constants while creating a connection object
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2011/5/24 Georg Brandl <g.brandl at gmx.net>:
On 24.05.2011 18:08, benjamin.peterson wrote:
http://hg.python.org/cpython/rev/8f403199f999 changeset: 70331:8f403199f999 user: Benjamin Peterson <benjamin at python.org> date: Tue May 24 11:09:06 2011 -0500 summary: move specialized dir implementations into dir methods (closes #12166)
+static PyMethodDef modulemethods[] = { + {"dir", moduledir, METHNOARGS, + PyDocSTR("dir() -> specialized dir() implementation")}, + {0} +}; static PyMethodDef typemethods[] = { {"mro", (PyCFunction)mroexternal, METHNOARGS, PyDocSTR("mro() -> list\nreturn a type's method resolution order")}, @@ -2585,6 +2661,8 @@ PyDocSTR("instancecheck() -> check if an object is an instance")}, {"subclasscheck", type_subclasscheck, METHO,_ PyDocSTR("subclasscheck() -> check if a class is a subclass")}, + {"dir", typedir, METHNOARGS, + PyDocSTR("dir() -> specialized dir implementation for types")}, static PyMethodDef objectmethods[] = { {"reduceex", objectreduceex, METHVARARGS, PyDocSTR("helper for pickle")}, @@ -3449,6 +3574,8 @@ PyDocSTR("default object formatter")}, {"sizeof", objectsizeof, METHNOARGS, PyDocSTR("sizeof() -> size of object in memory, in bytes")}, + {"dir", objectdir, METHNOARGS, + PyDocSTR("dir() -> default dir() implementation")}, This is interesting: I though we use "->" to specify the return value (or its type). instancecheck and subclasscheck set a different precedent, while sizeof follows.
Yes, I was wondering about that, so I just picked one. :) "->" seems to be better for return values, though, given the resemblance to annotations.
-- Regards, Benjamin
- Previous message: [Python-Dev] cpython: move specialized dir implementations into __dir__ methods (closes #12166)
- Next message: [Python-Dev] [pyodbc] Setting values to SQL_* constants while creating a connection object
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]