Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove isinstance() check for namedtuple_as_object #22

Merged
merged 2 commits into from
Dec 5, 2011

Conversation

singingwolfboy
Copy link
Contributor

Using isinstance() is not Pythonic and should be avoided when possible.
By using duck-typing instead, we can easily support other objects
that do not inherit from tuple but still support the same API as
namedtuple, such as objects created using the recordtype library:
http://pypi.python.org/pypi/recordtype

Using isinstance() is not Pythonic and should be avoided when possible.
By using duck-typing instead, we can easily support other objects
that do not inherit from tuple but still support the same API as
namedtuple, such as objects created using the `recordtype` library:
http://pypi.python.org/pypi/recordtype
@etrepum
Copy link
Member

etrepum commented Nov 18, 2011

This seems like a reasonable thing to do, but I will need some tests and updates to docs (index.rst) to reflect the change. Do you want to do this? If not, I'll get around to it in the next few weeks.

@etrepum
Copy link
Member

etrepum commented Nov 19, 2011

Take a look at this branch, includes your changes and I added some docs and tests. Had a bit more time than I expected today. master...namedtuple_duck-gh22

@singingwolfboy
Copy link
Contributor Author

Looks good to me! Sorry it took me so long to get back to this. Do you need me to do anything to get this merged into master?

@etrepum etrepum merged commit edfa765 into simplejson:master Dec 5, 2011
jperkin pushed a commit to TritonDataCenter/pkgsrc-legacy that referenced this pull request Dec 9, 2013
Version 2.5.2 released 2012-05-10

* Fix for regression introduced in 2.5.1
  simplejson/simplejson#35

Version 2.5.1 released 2012-05-10

* Support for use_decimal=True in environments that use Python
  sub-interpreters such as uWSGI
  simplejson/simplejson#34

Version 2.5.0 released 2012-03-29

* New item_sort_key option for encoder to allow fine grained control of sorted
  output

Version 2.4.0 released 2012-03-06

* New bigint_as_string option for encoder to trade JavaScript number precision
  issues for type issues.
  simplejson/simplejson#31

Version 2.3.3 released 2012-02-27

* Allow unknown numerical types for indent parameter
  simplejson/simplejson#29

Version 2.3.2 released 2011-12-30

* Fix crashing regression in speedups introduced in 2.3.1

Version 2.3.1 released 2011-12-29

* namedtuple_as_object now checks _asdict to ensure that it
  is callable.
  simplejson/simplejson#26

Version 2.3.0 released 2011-12-05

* Any objects with _asdict() methods are now considered for
  namedtuple_as_object.
  simplejson/simplejson#22
jsonn pushed a commit to jsonn/pkgsrc that referenced this pull request Oct 11, 2014
Version 2.5.2 released 2012-05-10

* Fix for regression introduced in 2.5.1
  simplejson/simplejson#35

Version 2.5.1 released 2012-05-10

* Support for use_decimal=True in environments that use Python
  sub-interpreters such as uWSGI
  simplejson/simplejson#34

Version 2.5.0 released 2012-03-29

* New item_sort_key option for encoder to allow fine grained control of sorted
  output

Version 2.4.0 released 2012-03-06

* New bigint_as_string option for encoder to trade JavaScript number precision
  issues for type issues.
  simplejson/simplejson#31

Version 2.3.3 released 2012-02-27

* Allow unknown numerical types for indent parameter
  simplejson/simplejson#29

Version 2.3.2 released 2011-12-30

* Fix crashing regression in speedups introduced in 2.3.1

Version 2.3.1 released 2011-12-29

* namedtuple_as_object now checks _asdict to ensure that it
  is callable.
  simplejson/simplejson#26

Version 2.3.0 released 2011-12-05

* Any objects with _asdict() methods are now considered for
  namedtuple_as_object.
  simplejson/simplejson#22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants