問題タブ [python-object]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
4 に答える
211 参照

python - Getting inputs to a function from a python object

I have a class. This class has a list of functions that are to be evaluated by a different program.

There is a function that adds functions to an instance of SomeClass, via something like:

Where check_number is a function that will check if number is greater than 10, let's say.

If I take SomeClassInstance.functions_to_evaluate and print it, I get a bunch of python objects, like so:

I am wondering if it is possible for me to extract the input given to check_number, so something like:

SomeClassInstance.functions_to_evaluate[0].python_feature() that will return "5" or whatever the input to check_number was to me.

0 投票する
1 に答える
23 参照

memory-management - Python の 2 つの別々の初期化に同じオブジェクト

Python では、この例のように 2 つの変数が同じ値で別々に割り当てられている場合、なぜ 2 つの変数が同じオブジェクトを参照するのでしょうか?

例 :