Rajendra Dharmkar has Published 154 Articles

What are Python namespaces all about?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 30-Jul-2019 22:30:20

271 Views

Namespace is a way to implement scope. In Python, each package, module, class, function and method function owns a "namespace" in which variable names are resolved. When a function,  module or package is evaluated (that is, starts execution), a namespace is created. Think of it as an "evaluation context". When ... Read More

Do recursive functions in Python create a new namespace each time the function calls itself?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 30-Jul-2019 22:30:20

230 Views

Yes, a function call (any function call, not just recursive ones) creates a new namespace. BUT, when given as parameters, OBJECTS are passed by reference.So, the new namespace get its own copy of this reference but it still refers to the same object as in the calling function, and if ... Read More

What is the max length of a Python string?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 30-Jul-2019 22:30:20

4K+ Views

With a 64-bit Python installation, and 64 GB of memory, a Python 2 string of around 63 GB should be quite feasible. If you can upgrade your memory much beyond that, your maximum feasible strings should get proportionally longer. But this comes with a hit to the runtimes.With a typical ... Read More

Where can I find good reference document on python exceptions?

Rajendra Dharmkar

Rajendra Dharmkar

Updated on 30-Jul-2019 22:30:20

124 Views

The following link is a  good reference document on python exceptionshttps://docs.python.org/2/library/exceptions.html

Advertisements