jazzband / geojson

Python bindings and utilities for GeoJSON
https://pypi.python.org/pypi/geojson/
BSD 3-Clause "New" or "Revised" License
908 stars 120 forks source link

Stop allowing property access via __getitem__/__setitem__ #41

Closed frewsxcv closed 6 years ago

frewsxcv commented 9 years ago

Backwards incompatible change

JesseWeinstein commented 7 years ago

Er, should this still be open?

frewsxcv commented 6 years ago

right now with this library, one can do both of these:

In [12]: geojson.loads('{"type": "Feature","geometry": {"type": "Point","coordinates": [125.6, 10.1]},"properties": 
    ...: {"name": "Dinagat Islands"}}').type
Out[12]: 'Feature'

In [13]: geojson.loads('{"type": "Feature","geometry": {"type": "Point","coordinates": [125.6, 10.1]},"properties": 
    ...: {"name": "Dinagat Islands"}}')['type']
Out[13]: 'Feature'

when i first opened the issue, i had interest in wanting to disallow indexing the with ['type'] for the geojson.feature.Feature object (removing the __getitem__ implementation). i don't feel strongly it should be removed, i'm okay keeping it if people want it. what do you think?

JesseWeinstein commented 6 years ago

I think it's fine to leave it; I'm in favor of more rather than less ways to access things.

frewsxcv commented 6 years ago

sounds good to me 👍