Questions tagged as 'cpython'

1
answer

Why does 2 * i * i tend to be faster than 2 * (i * i) when i is integer?

The two multiplications, 2*i*i and 2*(i*i) , are equal and should generate the same result, which only changes is the order that the multiplications are made, but apparently they are treated differently by the interpreter. > In th...
asked by 03.01.2019 / 12:19
1
answer

Why do these two ways of initializing the same list in Python generate structures of different sizes?

It is common to need to initialize a list in Python with a defined amount of elements and we can do this in two ways: 1) multiplying the list with one element by the desired quantity; or 2) use the list comprehensions technique.    Note:...
asked by 01.08.2018 / 02:50
2
answers

Sources of the standard Python functions

How can I find out the algorithm behind functions like split() and in in Python, because in my college there are some forbidden functions.     
asked by 01.12.2018 / 01:25
0
answers

How to know if the refcount of any object in python is not 0 when the interpreter is closed?

I created a module and a submodule with CPython in which I put a dubious Py_INCREF(submodule); . The code is this: PyDoc_STRVAR(MEU_modulo_doc, "Esse eh meu modulo.\n" ); static struct PyModuleDef MEU_modulo_def = { PyModuleDef_HEAD_...
asked by 14.09.2018 / 19:50