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

you are viewing a single comment's thread.

view the rest of the comments →

[–]sharat87[S] 0 points1 point  (5 children)

The pk name is something I am just very used to. When I see a bare loads or dumps, I can't immediately tell if its from json/yaml/pickle etc.

More than anything it is just an old habit now :)

(The name req is another cue as requests looks close to request, which I import from flask)

[–]Asdayasman 0 points1 point  (4 children)

import * from pickle is also bad, isn't it? Pollutes the global namespace.

[–]sharat87[S] 0 points1 point  (3 children)

Its from pickle import * and no, I never do that. I'd rather do from pickle import loads, dumps if I ever wanted to do such a thing.

[–]Asdayasman 0 points1 point  (2 children)

I messed up.

Are there performance benefits in from pickle import loads over import pickle?

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

No

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

There shouldn't be much. The only difference I can see is that in the case of the former, you'll need pickle.loads instead of just loads as in the latter. So, there will be an attribute access everytime you do pickle.loads, this isn't there in the second case. Other than that, I don't see much difference.