What Qualifies as Global Constants in Python -


i trying become familiar proper terminology.

what data structures can global constants? have immutable data structures?

for example, know global constant:

this_constant = 5 

but, example, can list constant? provided doesn't change throughout program, though mutable data type?

list_constant = [1, 2, 3, 4] 

another way of asking question is, proper use mutable datatypes global constants?

from experience (no sources): yes. long don't change value throughout program, it's allowed global constant. code style message , other programmers saying variable's value never change.

edit:

as @nightshadequeen noted, using tuple better, because immutable. not (accidentally) change constant's value.


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -