On 2012-06-14, at 10:50 AM, Alexandre Zani wrote: > On Thu, Jun 14, 2012 at 6:50 AM, Yury Selivanov <yselivanov.ml at gmail.com> wrote: >> I guess if nobody really wants to keep 'is_args', we can alter the >> PEP. >> >> Let's consider replacement of 'Parameter.is_*' set of attributes with >> a single 'Parameter.kind' attribute, which will have the following >> possible values: 'positional', 'vararg', 'keyword-only', 'varkwarg'. >> >> (I think 'positional' is more intuitive than 'index'?) >> > > I disagree largely for readability reasons. As the PEP stands, I can > look at a Parameter object and immediately understand what the > different possible values are by just listing its attributes. The kind > attribute makes that harder. > > Comparing with strings is error prone. If I do param.is_varargs > (adding an s at the end of the attribute name) I will see an attribute > error and know what is going on. If I do the same mistake with the > kind attribute param.kind == "varargs", the expression will just > always be False without any explanation. Agree on this one, good point (although unit tests generally help to avoid those problems.) - Yury
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4