ruby instance variable in python

Jussi Piitulainen jpiitula at ling.helsinki.fi
Tue Oct 7 14:46:14 CEST 2014


flebber writes:

> On Monday, 6 October 2014 21:07:24 UTC+11, roro codeath  wrote:
> > in ruby:
> > 
> > 
> > module M
> > def ins_var
> > @ins_var ||= nil
> > end

...

> I took || to be a ternary. So I assumed your code just sets ins_var
> to nil and then is called in module m and supplied a val. Could be
> wrong.
> 
> if ins_var is None:
>     ins_var = 'val'

Just out of interest, please, do you think the word 'ternary' is more
or less synonymous with 'conditional'?

I'm not being sarcastic. This possibility just occurred to me, and the
world will begin to make more sense to me if it turns out that there
are people who simply do not think 'three' when they think 'ternary'.



More information about the Python-list mailing list