Re: Best way to set up a dict of defaults?



On Sep 4, 4:50 pm, Twylite <twylite.cr...@xxxxxxxxx> wrote:
But some of the default values are calculated/derived rather than
static (say based on the name of the application, $argv0). What is
the best way for me to set up these defaults?
Am I missing something obvious; is there a better way?

Anything against procs ?

proc def {k v} {set ::deftab($k) $v}

def x 12
def log.file [foo [bar [baz]]]

-Alex

.



Relevant Pages

  • Re: query
    ... def method_missing ... a.name # a.name will print in method missing & name method is missing. ... Ruby provides a full toolkit for making two objects of the same class ... puts "in methodmissing" ...
    (comp.lang.ruby)
  • Re: Postpone creation of attributes until needed
    ... know if it is a) safe, ... possible to compute the missing values. ... another thread initiates your instance, I don't understand how this is ... def MyClass: ...
    (comp.lang.python)
  • Re: "Battleship" style game
    ... be half the current size - without loss of functionality. ... If I'm missing a bigger-picture idea, I'd like to know about it. ... want to make can be made without breaking any client code. ... def _set_a: ...
    (comp.lang.python)
  • Re: Distinguishing attributes and methods
    ... all callable attributes bound to objects other than toplevel) are ... derives from a certain base class), or type-by-behavior (a method is a ... What is the distinction that I'm missing? ... def func: ...
    (comp.lang.python)
  • Re: query
    ... Hunt Hunt wrote: ... def method_missing ... puts in methodmissing ... You're missing the quotes around the first puts: ...
    (comp.lang.ruby)