[Tutor] advice on global variables

Prasad, Ramit ramit.prasad at jpmorgan.com
Wed Jul 11 00:03:09 CEST 2012


> > Just as a note, this would not really work if the variable needs to be
> > changed and read from several places when the value is an immutable
> > type such as numbers / strings. In that case, then you could use
> > the same logic but instead place the value in a list and pass that
> > and always check/update the first element of the list.
> >
> 
> That's a terrible idea. That's basically replicating the behavior of a
> global while hiding that fact which makes the code even less readable.

I agree, but sometimes getting something working is more important
to the person than doing something correctly. 

Not really sure about the OP's actual use case, but chances are he would 
be served better by creating a properties/static data module and
keeping the flag in there. 

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  


More information about the Tutor mailing list