[Python] A function attribute is not a local?
Where do I find f.a? https://code.sololearn.com/c39Elhwdu0hE/?ref=app
function attributes are not local variables, but are added to the func_dict for the function in a key : value relationship. They can be accessed via the __dict__ of the function. print(fun.__dict__) https://www.python.org/dev/peps/pep-0232/
https://docs.python.org/3.9/reference/datamodel.html#objects-values-and-types Scroll down to callable types. Also, lookup __dict__ The PEP is probably the most informative from what I've seen.
I think it's logical to say F.a is not local(). f.a is not a real variable but an attribute to f(a global object). All what the local() function do is to create a table containing information about the current context (must be global) Current context here is f
ChaoticDawg thanks! you have a docu for it?
Mirielle yes. f.a is different to b. And thinking about the difference and locals() akes everything a bit clearer.
Python — File Handling
Question is write a c program to print prime numbers up to n and print the largest number in array.
Achievements on Sololearn
How to draw in the console?
Question - Java: Pyramid layers