Skip to content

BUG/OFMT: fix repring of python3 bytes objects #4456

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

Merged
merged 3 commits into from
Aug 3, 2013
Merged

BUG/OFMT: fix repring of python3 bytes objects #4456

merged 3 commits into from
Aug 3, 2013

Conversation

cpcloud
Copy link
Member

@cpcloud cpcloud commented Aug 3, 2013

closes #4455.

@ghost ghost assigned cpcloud Aug 3, 2013
@@ -1613,7 +1613,8 @@ def _is_sequence(x):
try:
iter(x)
len(x) # it has a length
return not isinstance(x, compat.string_types) and True
return not isinstance(x, compat.string_types +
(compat.binary_type,)) and True
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jreback is this True here for a reason? It will have no effect on the return value of _is_sequence...

@cpcloud
Copy link
Member Author

cpcloud commented Aug 3, 2013

@jreback ok 2 merge?

return not isinstance(x, compat.string_types) and True
except Exception:
len(x) # it has a length
return not isinstance(x, compat.string_types + (compat.binary_type,))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would define something like compat.string_and_binary_types

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw - that only matters for python3 - bytes is str in py2
On Aug 3, 2013 1:47 PM, "Phillip Cloud" notifications@github.com wrote:

In pandas/core/common.py:

@@ -1612,9 +1612,9 @@ def is_list_like(arg):
def _is_sequence(x):
try:
iter(x)

  •    len(x) # it has a length
    
  •    return not isinstance(x, compat.string_types) and True
    
  • except Exception:
  •    len(x)  # it has a length
    
  •    return not isinstance(x, compat.string_types + (compat.binary_type,))
    

ok


Reply to this email directly or view it on GitHubhttps://github.com//pull/4456/files#r5567493
.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but that's issue here...

@cpcloud
Copy link
Member Author

cpcloud commented Aug 3, 2013

think this is good 2 go now

@jreback
Copy link
Contributor

jreback commented Aug 3, 2013

ok

cpcloud added a commit that referenced this pull request Aug 3, 2013
BUG/OFMT: fix repring of python3 bytes objects
@cpcloud cpcloud merged commit 52712e2 into pandas-dev:master Aug 3, 2013
@cpcloud cpcloud deleted the fix-py3-bytes-repr branch August 3, 2013 20:01
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.

awkward repring on python3 bytes types
3 participants