Passing a variable back and forth vs. using a python constant -


i have python module few functions. @ moment, these functions called main(), expect import module other files in future.

i have counter variable used , modified of these functions. @ moment passing around parameter, , returning every function call.

this works seems silly. considered including constant variable counter used directly functions. however, assume constants not supposed modified.

is there cleaner approach passing counter variable , forth?

creating class counter 1 of attribute solution.

since current functions explicitly called in future, making counter attribute save callee of variable passing , of additional error checking.

also counter variable can abstracted callee function reducing errors. point depends on implementation though.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -