467,077 Members | 974 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,077 developers. It's quick & easy.

Only Dict,tuples ,strings and list are reference

256MB
Hi,

Is it not possible to reference other than Dict,tuples ,strings and list datatypes /variables ,when we call the functions?

Say int,float and boolean

Thanks
PSB
Apr 17 '07 #1
  • viewed: 1000
Share:
3 Replies
bartonc
Expert 4TB
Hi,

Is it not possible to reference other than Dict,tuples ,strings and list datatypes /variables ,when we call the functions?

Say int,float and boolean

Thanks
PSB
If Python doesn't do it ("Say int, float and boolean"), you can do it with a class as shown in our lengthy discussion on globals.
Apr 18 '07 #2
256MB
Could you please help me without using global variables.With Sample example

-PSB
Apr 19 '07 #3
bartonc
Expert 4TB
Could you please help me without using global variables.With Sample example

-PSB
Sure:
Expand|Select|Wrap|Line Numbers
  1. class BoolByRef:  # simulate a C structure
  2.     value = True   # or whatever you want the defualt to be
  3.  
  4.  
  5. boolByRef = BoolByRef
  6.  
  7.  
  8. def ChangeBoolByRef():
  9.     boolByRef.value = False
  10.  
  11. def PrintBoolByRef():
  12.     print boolByRef.value
  13.  
  14.  
  15.  
  16. ChangeBoolByRef()
  17. PrintBoolByRef()
  18.  
Apr 19 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

11 posts views Thread by Xavier | last post: by
11 posts views Thread by Nicolas Girard | last post: by
9 posts views Thread by Robin Cull | last post: by
17 posts views Thread by Pierre Fortin | last post: by
8 posts views Thread by nidhog@gmail.com | last post: by
4 posts views Thread by =?utf-8?B?TWFjaWVqIEJsaXppxYRza2k=?= | last post: by
reply views Thread by rkmr.em@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.