Skip to content

Added prettyprint for dict modules#21

Closed
mithro wants to merge 1 commit intozestyping:masterfrom
icook:master
Closed

Added prettyprint for dict modules#21
mithro wants to merge 1 commit intozestyping:masterfrom
icook:master

Conversation

@mithro
Copy link
Collaborator

@mithro mithro commented Dec 2, 2014

Another random addition which might be worth merging.

Copy link
Contributor

Choose a reason for hiding this comment

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

dictionaries can be large so instead of returning here, I'd set value = pp.pformat(value)

Then value will be shortened if necessary by self.TEXT_REPR.repr() for inclusion in /tmp/q and the full value of value will be placed in a file.

Copy link
Contributor

Choose a reason for hiding this comment

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

And if we send to an external file, probably okay to leave an indent of 1 or 2 :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm.. but TextRepr.repr ends up escaping the pprint formatting which is not desirable. So it's not quite that simple :-(

@abadger
Copy link
Contributor

abadger commented Dec 5, 2014

Okay, here's a different take on pretty printing: https://gist.github.com/abadger/1db069b6127cc65e914d

What do you think? I can turn it into a pull request if you like it better than yours or you can just cherrypick the ideas that you like :-)

I wasn't sure if going forward we're going to be pushing to this repo or the mithro repo (I noticed that the 2.5 release was created off of the mithro repo, thus my confusion).

mithro pushed a commit to mithro/q that referenced this pull request Jun 10, 2015
As discussed in zestyping#21 I've made some changes
to the pprint change proposed there.

* This will save long values into a separate file.

* This makes pprint of the variable the default.  I think this is a good idea
  because it will handle things like dicts nested within lists and other
  builtin types.
@mithro
Copy link
Collaborator Author

mithro commented Jun 10, 2015

The pretty printing changes have ended up in #28 now. Closing this pull request.

@mithro mithro closed this Jun 10, 2015
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.

3 participants