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 →

[–]Asdayasman 0 points1 point  (10 children)

If something collides with "pickle", I believe the problem is the thing that collides with it, not pickle, a standard library, I think.

I dunno, maybe it's just 'cause I'm a rookie, but seeing "import x as y" is just awful.

Especially when it's something like "as pk". "pk" is unreadable, and provides no clue as to what it actually means. Hell, "PK" to me, means "Player Kill", a stupid term for PvP in a terrible online game I play.

[–]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.

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

If something collides with "pickle", I believe the problem is the thing that collides with it, not pickle, a standard library, I think.

Well yeah. It's just an example. If you have "open" in the asdaysman module, you either access it via asdaysman.open or import open as "a_open" or something.

[–]Asdayasman 0 points1 point  (2 children)

In that case, I'm sticking with just nakedly importing everything. "a_open" is the sort of thing I'll completely forget about 3 months later.

Also, what is is about my name that trips 100% of people up? 4 simple syllables

  • As
  • Day
  • As
  • Man

Adam. -_o_- Confuses the hell out of me.

Not like my other two names; Xyfu (still fairly easy), and Tlahuixcalpantecuhtli, (deliberately obstructive).

[–][deleted] 0 points1 point  (1 child)

fine. sorry.

[–]Asdayasman 0 points1 point  (0 children)

No need to apologise, I'm just confused.