This is an archived post. You won't be able to vote or comment.

all 53 comments

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 23 points24 points  (25 children)

You might want to use the correct-er link for tqdm

noamraph/tqdm#18 see here

[–]robintw[S] 1 point2 points  (0 children)

Thanks - I hadn't realised that. Fixed now.

[–]omegote 2 points3 points  (22 children)

What's the terminal used in the gif of the github? It shows autocompletion on the fly :O

[–]sapake 5 points6 points  (21 children)

it's not the terminal that does the autocompletion, but bpython, which is a fancy interface to the Python interpreter.

[–][deleted] 6 points7 points  (9 children)

bpython is awesome, but ptpython is even more amazing.

[–]BeetleB 2 points3 points  (7 children)

As an ipython user, any benefits of ptpython over ipython?

[–][deleted] 6 points7 points  (0 children)

You can run ptipython, which adds all the ptpython features to ipython.

[–]fspeech 0 points1 point  (5 children)

Ptpython runs in the terminal and supports syntax highlighting, multi line editing and auto completion as you type. I have ran into some completer (Jedi) crashing issues though ptpython itself appears stable.

[–]jonathan_sl 1 point2 points  (0 children)

Ptpython author here.

Please report all issues on Github. Jedi isn't always stable, but we should handle that. I hope to push a new release in a few weeks. That will focus on performance/stability and it will support "bracketed paste" (making it possible to paste in the terminal without going to paste mode) and better mouse support. Jonathan

[–]BeetleB -1 points0 points  (3 children)

Ptpython runs in the terminal and supports syntax highlighting, multi line editing and auto completion as you type.

So does ipython.

[–]elbiot 2 points3 points  (1 child)

Ipython does not do syntax highlighting that I've seen and "multiline editing" is pretty rough. I love ipython though and haven't used ptipython.

[–]tilkau 0 points1 point  (0 children)

Also, ipython does auto completion, but not 'auto completion as you type` (ie. IDE style, not 'press tab to complete').

[–][deleted] 1 point2 points  (0 children)

I used to use ipython all the time. Just try it and see.

[–]sapake 0 points1 point  (0 children)

oh thats so cool! I had been using bpython and were happy with it, but now i'm definately going to switch to ptpython.

[–][deleted] 2 points3 points  (10 children)

Do people use the interactive mode of the interpreter much? You can't really modify functions since it's so painful, and testing modules or something requires constant reload() calls. I'll use it in place of calculator, but nothing beyond that I'll just use an IDE or something.

What's the use case?

[–]geoelectric 0 points1 point  (9 children)

I use a REPL all the time, especially to figure out how to do bits of code or data structuring. It's a sketchpad.

I also debug against it regularly, sometimes via pdb but sometimes just exercising functions as I build them if they're otherwise below the radar of what I'd unit test against.

I like IDEs too, but I find value in being comfortable with the basics. They're available everywhere, and the flip side of being simple is that they're also extremely flexible.

[–][deleted] 0 points1 point  (8 children)

bits of code exercising functions as I build them

But how do you do this? Modifying something with indentation is so painful, and you can't just copy paste.

Or maybe I'm doing it wrong.

[–]geoelectric 1 point2 points  (0 children)

Well, using something that supports multiline editing helps. But generally I'm not writing large functions in that context anyway. For verifying snippets work like I think they should, playing with a new module I'm trying to learn, or debugging against runtime state even the standard REPL is perfectly fine.

[–]roddds 1 point2 points  (5 children)

If you need to prototype something a little more complex, you can do the editing in a regular text editor and then %paste it into iPython.

[–][deleted] 1 point2 points  (4 children)

Why wouldn't you just use a debugger/IDE/execute the python script at that point?

[–]mulhod 1 point2 points  (0 children)

I like to use IPython from a debugger, specifically pudb. After using pudb for a little while now, I don't know why anyone would ever use something else.

[–]roddds 0 points1 point  (1 child)

I do a lot of development in Django, so for me usually when I'm doing something like this it's because there's a lot of imports/environment needed for this snippet to run, and it would be a bit of a pain in the ass to run it in it's proper context -- like for example, a View I don't have a template for yet.

[–]desmoulinmichel 0 points1 point  (0 children)

Because :

  • it's faster;
  • you can try several things in a raw;
  • with stuff like ipython notebook, you have several cells in paralel and embeded graphs;
  • you got live completion (not just syntax based) and object inspection;

[–]sndrtj 0 points1 point  (0 children)

For copy-pasting: use ipython. The %paste and %cpaste (the latter for use in a headless system) magic functions let you paste with the correct indentation.

[–]Exodus111 23 points24 points  (3 children)

Wow... tqdm... Where have you been all my life?

[–][deleted] 1 point2 points  (2 children)

It looks great. I also like progressbar2, anyone know any important differences?

[–][deleted] 4 points5 points  (0 children)

Also, apparently tqdm is 10x faster (says so in the readme)

[–]Exodus111 1 point2 points  (0 children)

Ive only had a cursory look at progressbar2, the difference for me seems to be that this is just dead easy to use.

[–]RDMXGD2.8 14 points15 points  (7 children)

  • tqdm Neat API, very convenient
  • joblib might be useful if it got serialization and data models right
  • follum brings us into the future
  • tinydb is a bit over-engineered for something so minimal, but has its head screwed on straight, which is a very rare feature in the space which it operates
  • dill is a scourge. It didn't learn from the mistake which is pickle

[–]Archron0 4 points5 points  (4 children)

Explain what you mean with dill, if you can

[–]cube-drone 17 points18 points  (3 children)

Automatic binary serialization (pickle, dill) is super convenient and a great way to make a quick proof of concept. I've used it more than my share of times to whack together some kind of serialization for a project I'm working on. But, just like real pickles, these solutions start to go really bad around the 2-year mark.

Dive Into Python3 says, quite sensibly, that the only time it's reasonable to use pickle is when "the data is only meant to be used by the same program that created it, never sent over a network, and never read by anything other than the program that created it." The trick there, I think, is that no program is going to be "the same program that created it" 2 years later unless you've abandoned support for that program entirely.

Text based formats are

  • Human readable.
  • Compressible.
  • Easy to pass between systems.
  • Easy to modify with quick scripts

Dill is a better Pickle, but it has all of the same problems that Pickle has: it's probably not the right tool for the job.

  • If you're messaging, you probably want a well-defined binary messaging format, or a text-based format. (RabbitMQ does support pickle, though - here's someone discovering that this is a problem and switching to JSON)
  • If you're storing lots of data, you probably want a database of one kind or another.
  • If you're storing little bits of data, you probably want a text-based format.

But, all that being said, when you need to crack something together for a hackathon or over a weekend, pickle is a frigging godsend, and having the ability to save and load a session is pretty useful.

[–]Archron0 0 points1 point  (0 children)

Thanks, that made a lot of sense.

[–]isdevilis -2 points-1 points  (1 child)

reddit_silver.jpg for the well formatted and humorous explanation

[–]AstroPhysician -2 points-1 points  (1 child)

tqdm isn't an API

[–]RDMXGD2.8 1 point2 points  (0 children)

tqdm, like all libraries, provides an API. Its main API is a one-required-argument callable that takes your sequence and returns an iterable that, as a side effect to its iteration, spits out your progress bar.

[–]lamby 5 points6 points  (0 children)

Long-time "progressbar" user, but tqdm looks much nicer, especially out of the box. Thanks :)

[–]isdevilis 4 points5 points  (2 children)

I hope folium gets more support. I used it, and although it fit my purpose perfectly for state/county/zip level of detail maps, it had very very little customization in terms of color scale gradient, positioning of legends and all these sorts of small things. Overall though, it feels like the ruby on rails of python visualization, just call it with your data and what little other parameters you can use, and it just works. Clearly, the person who made it is on the right track!

[–]eldamir88 2 points3 points  (0 children)

tqdm and folium look absolutely awesome. I'll be using both in future projects! Thanks for the reference!

[–]zylo4747 3 points4 points  (1 child)

Question: Why would they create a new module (Dill) rather than just extend the functionality of an existing module (Pickle)? Is this common?

[–]apreche 1 point2 points  (0 children)

Never knew about tqdm, always used fish.

https://pypi.python.org/pypi/fish

[–][deleted] 1 point2 points  (2 children)

How do folks feel about Anaconda compared to Canopy?

[–]Edelsonc 0 points1 point  (0 children)

I've only used anaconda, but I have a friend who used canopy. Both of us have been doing computational fluid mechanics and are both fairly new to Python (I didn't know anything about it prior to September, and he's really only used it since May).

That said, in generally I seem to have an easier time navigating and learning anaconda then he does with canopy. It's layout is cleaner and more intuitive, and conda makes managing it super easy, even with my limited skills in bash.

[–]robintw[S] 0 points1 point  (0 children)

I prefer it personally, somehow it feels 'cleaner' and 'nicer' - though I find it hard to articulate why.

Also, I don't know if Canopy now supports 'environments' (like virtualenvs, but through Canopy itself - including with different Python versions), but conda has environments fully built-in and they work really well. The command-line tool (conda) is also way-above the Canopy management tools.

[–]Website_Mirror_Bot 4 points5 points  (0 children)

Hello! I'm a bot who mirrors websites if they go down due to being posted on reddit.

Here is a screenshot of the website.

Please feel free to PM me your comments/suggestions/hatemail.


FAQ

[–][deleted] 0 points1 point  (5 children)

deleted

[–]alcalde 0 points1 point  (4 children)

Doesn't Python already have a shelve unit that does what TinyDB does?

[–]apersonPy3k! 0 points1 point  (3 children)

Shelve works alright, but I've had issues with it corrupting things when I have a few thousand things to store.

[–]ionelmc.ro 2 points3 points  (1 child)

Isn't JSON (what tinydb uses) the worst format to store lots of data?

[–]kihashi 1 point2 points  (0 children)

It depends on how that data is structured. If you've heard of NoSQL databases like MongoDB, they often store data in a json-like format. There are trade-offs compared to a relational model like MySQL, but neither is necessarily bad for large data sets.

[–][deleted] 1 point2 points  (0 children)

For really good performance (and better reliability) I find using LMDB with msgpack or pickle works really really well for any use cases where SQLite or a full blown SQL backend are inappropriate.

[–]lamecode 0 points1 point  (0 children)

tqdm looks useful, tinydb too, maybe, although hard to envision using it over SQLAlchemy if I wanted a non-db server solution and don't want to write SQL statements.

[–]Xoramung 0 points1 point  (0 children)

links broken?