python - Initialize different variables with different value in a single statement -


I have Python variable as shown below. I want to start all these variables with different values ​​in the same statement in the global A, B, C

.

Is this possible?

  a = b = c = Uuid.uuid1 () // to A, B and C   

call uuid.uuid1 () three times:

  a, b, c = Uuid.uuid1 (), uuid.uuid1 (), uuid.uuid1 ()   

You can make it a loop, but for 3 fixed items Why bother? In addition, for such an unexpected assignment with only 2 or 3 elements with a CPithon compiler

If you use a loop in any way (if you have some additional goals), then use the generator expression and avoid creating a list object: for xrange (8)

  a, b, c, d, e, f, g, h = (uuid.uuid1 ())    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -