Quantcast
Channel: How to create inline objects with properties? - Stack Overflow
Viewing all articles
Browse latest Browse all 10

How to create inline objects with properties?

$
0
0

In Javascript it would be:

var newObject = { 'propertyName' : 'propertyValue' };newObject.propertyName;  // returns "propertyValue"

But the same syntax in Python would create a dictionary, and that's not what I want

new_object = {'propertyName': 'propertyValue'}new_object.propertyName  # raises an AttributeError

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images