Fixed indentation of Python examples in C comments.
This commit is contained in:
commit
553e156921
|
@ -2985,18 +2985,18 @@ def permutations(iterable, r=None):
|
||||||
cycles = range(n-r+1, n+1)[::-1]
|
cycles = range(n-r+1, n+1)[::-1]
|
||||||
yield tuple(pool[i] for i in indices[:r])
|
yield tuple(pool[i] for i in indices[:r])
|
||||||
while n:
|
while n:
|
||||||
for i in reversed(range(r)):
|
for i in reversed(range(r)):
|
||||||
cycles[i] -= 1
|
cycles[i] -= 1
|
||||||
if cycles[i] == 0:
|
if cycles[i] == 0:
|
||||||
indices[i:] = indices[i+1:] + indices[i:i+1]
|
indices[i:] = indices[i+1:] + indices[i:i+1]
|
||||||
cycles[i] = n - i
|
cycles[i] = n - i
|
||||||
|
else:
|
||||||
|
j = cycles[i]
|
||||||
|
indices[i], indices[-j] = indices[-j], indices[i]
|
||||||
|
yield tuple(pool[i] for i in indices[:r])
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
j = cycles[i]
|
return
|
||||||
indices[i], indices[-j] = indices[-j], indices[i]
|
|
||||||
yield tuple(pool[i] for i in indices[:r])
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
return
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -1268,11 +1268,11 @@ PyWrapper_New(PyObject *d, PyObject *self)
|
||||||
/* A built-in 'property' type */
|
/* A built-in 'property' type */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
class property(object):
|
class property(object):
|
||||||
|
|
||||||
def __init__(self, fget=None, fset=None, fdel=None, doc=None):
|
def __init__(self, fget=None, fset=None, fdel=None, doc=None):
|
||||||
if doc is None and fget is not None and hasattr(fget, "__doc__"):
|
if doc is None and fget is not None and hasattr(fget, "__doc__"):
|
||||||
doc = fget.__doc__
|
doc = fget.__doc__
|
||||||
self.__get = fget
|
self.__get = fget
|
||||||
self.__set = fset
|
self.__set = fset
|
||||||
self.__del = fdel
|
self.__del = fdel
|
||||||
|
@ -1280,19 +1280,19 @@ PyWrapper_New(PyObject *d, PyObject *self)
|
||||||
|
|
||||||
def __get__(self, inst, type=None):
|
def __get__(self, inst, type=None):
|
||||||
if inst is None:
|
if inst is None:
|
||||||
return self
|
return self
|
||||||
if self.__get is None:
|
if self.__get is None:
|
||||||
raise AttributeError, "unreadable attribute"
|
raise AttributeError, "unreadable attribute"
|
||||||
return self.__get(inst)
|
return self.__get(inst)
|
||||||
|
|
||||||
def __set__(self, inst, value):
|
def __set__(self, inst, value):
|
||||||
if self.__set is None:
|
if self.__set is None:
|
||||||
raise AttributeError, "can't set attribute"
|
raise AttributeError, "can't set attribute"
|
||||||
return self.__set(inst, value)
|
return self.__set(inst, value)
|
||||||
|
|
||||||
def __delete__(self, inst):
|
def __delete__(self, inst):
|
||||||
if self.__del is None:
|
if self.__del is None:
|
||||||
raise AttributeError, "can't delete attribute"
|
raise AttributeError, "can't delete attribute"
|
||||||
return self.__del(inst)
|
return self.__del(inst)
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4245,7 +4245,7 @@ PyDoc_STRVAR(object_subclasshook_doc,
|
||||||
|
|
||||||
class object:
|
class object:
|
||||||
def __format__(self, format_spec):
|
def __format__(self, format_spec):
|
||||||
return format(str(self), format_spec)
|
return format(str(self), format_spec)
|
||||||
*/
|
*/
|
||||||
static PyObject *
|
static PyObject *
|
||||||
object_format(PyObject *self, PyObject *args)
|
object_format(PyObject *self, PyObject *args)
|
||||||
|
|
|
@ -1940,21 +1940,21 @@ InstallFilesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
/*
|
/*
|
||||||
* The scheme we have to use depends on the Python version...
|
* The scheme we have to use depends on the Python version...
|
||||||
if sys.version < "2.2":
|
if sys.version < "2.2":
|
||||||
WINDOWS_SCHEME = {
|
WINDOWS_SCHEME = {
|
||||||
'purelib': '$base',
|
'purelib': '$base',
|
||||||
'platlib': '$base',
|
'platlib': '$base',
|
||||||
'headers': '$base/Include/$dist_name',
|
'headers': '$base/Include/$dist_name',
|
||||||
'scripts': '$base/Scripts',
|
'scripts': '$base/Scripts',
|
||||||
'data' : '$base',
|
'data' : '$base',
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
WINDOWS_SCHEME = {
|
WINDOWS_SCHEME = {
|
||||||
'purelib': '$base/Lib/site-packages',
|
'purelib': '$base/Lib/site-packages',
|
||||||
'platlib': '$base/Lib/site-packages',
|
'platlib': '$base/Lib/site-packages',
|
||||||
'headers': '$base/Include/$dist_name',
|
'headers': '$base/Include/$dist_name',
|
||||||
'scripts': '$base/Scripts',
|
'scripts': '$base/Scripts',
|
||||||
'data' : '$base',
|
'data' : '$base',
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
scheme = GetScheme(py_major, py_minor);
|
scheme = GetScheme(py_major, py_minor);
|
||||||
/* Run the pre-install script. */
|
/* Run the pre-install script. */
|
||||||
|
|
|
@ -3725,9 +3725,9 @@ compiler_async_with(struct compiler *c, stmt_ty s, int pos)
|
||||||
BLOCK
|
BLOCK
|
||||||
finally:
|
finally:
|
||||||
if an exception was raised:
|
if an exception was raised:
|
||||||
exc = copy of (exception, instance, traceback)
|
exc = copy of (exception, instance, traceback)
|
||||||
else:
|
else:
|
||||||
exc = (None, None, None)
|
exc = (None, None, None)
|
||||||
exit(*exc)
|
exit(*exc)
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in New Issue