|
2012-05-26
| ||
| 20:09 | • Closed ticket [1714317fff]: dict get -default plus 7 other changes artifact: 9cf16217ed user: dkf | |
|
2007-12-30
| ||
| 22:36 | • Ticket [1714317fff]: 1 change artifact: b6bc1d5f2f user: dkf | |
|
2007-05-07
| ||
| 21:25 | • Ticket [1714317fff]: 4 changes artifact: baaae91d39 user: nobody | |
| 13:54 | • New ticket [1714317fff]. artifact: ad3a794ca6 user: dkf | |
dict get -default
Closed / Later1714317fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 15 years ago
Descriptionplain2007-05-07 13:54:14
[14:44]Colin[dict get? $x $y] is essentially [expr {[dict exists $x $y]?[dict get $x $y]:""}]
[14:44]Colinit's quite useful and makes the code cleaner.
[14:45]dkfI've thought about defaults, but the problem is that [dict get] has run out of syntax holes
...
[14:48]dkftheoretically, there's a single hole left
[14:48]dkf[dict get -default "foo" -- $dict $key ...]
[14:51]Colindkf, please consider adding the facility, it is useful.
[email protected]plain2007-05-07 21:25:02
Logged In: NO Please try to specify and implement this in a way that avoids making "--" mandatory in practice. I.e. since a dict cannot be an option a dict object should not be checked for options, and a dict with a string rep starting with "-" should not be a bad option error.
dkf Ticket [1714317fff]: 1 change
[History diff]2007-12-30 22:36:49
dkfplain2012-05-26 20:09:37
allow_comments - 1 See patch 2370575
Log in (anonymous is fine) to add a comment.