On Fri, Sep 4, 2020 at 7:19 PM haael <[email protected]> wrote:
>
> Yes, but that could also be said about ordinary global classes.

(Please don't top-post, it makes it very difficult to usefully quote
multiple people.)

>
>      if sys.args[1] == "a":
>          class A:
>             pass
>
>          a = A()
>
>          print(pickle.dumps(a))
>      else:
>          a = pickle.loads(input()) # no definition of class A in this run
>
>  > Apologies if I'm misunderstanding your point here, but it feels like
>  > what you're proposing would only work if you pickled and unpickled the
>  > data in the *same* running instance of the program.

Of course you COULD do that, but generally, any run of the program
will create equivalent classes with the same name. What you're
proposing would have some sort of unique ID generated for every class,
so how do you ensure that the correct class has the same ID?

If you're able to correctly match a class to its identifier, you could
far better do this yourself - or alternatively, have them all be the
SAME class with some sort of parameterization.

ChrisA
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/AIDFNUGUH4H6YVPCWDZHKKZQPWCLPO4A/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to