Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What I'd really like to see is new syntax for item access. Transform a::b into a['b'].

Items and attributes are different, and failing to distinguish can make your code fragile - for example, it looks like Dict().get will return the attribute, unlike Dict()['get']. And if a new python version adds a new method to dict, some of your uses of Dict() will now break.

But item access is ugly when dealing with nested JSON or any number of other things, and that leads to people like me using terrible hacks that ambiguate between the two.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: