3 ms·
The nice thing about named parameters in Python is that they're optional, and aren't all or nothing. From what I can tell, with this (and other similar hacks I
by FuzzyDunlop 14y ago
The nice thing about named parameters in Python is that they're optional, and aren't all or nothing.
From what I can tell, with this (and other similar hacks I've seen), you can either provide no named parameters, as usual, or you have to name every argument passed, in an array.
In such a case, I fail to see how implementing this can do anything but increase code complexity.
- melvinmt 14y agoThe example explicitly shows that optional parameters are not required: if (!$p->isOptional() and !isset($arr[$p->name])) throw new MissingArgumentException