On Tue, Feb 28, 2017 at 8:43 AM likage <[email protected]> wrote:

> I have another question - what about the function line?
>
> Eg.
> Class Something(object):
> def __init__(self, rotate=((0, 0), (0, 0), (0, 0)), scale=((1, 1), (1, 1),
> (1, 1)), u_jitter=(0,0), v_jitter=(0,0)):
>
> The character limit stops at the last open bracket of the scale parameter
> : `..., scale=((1, 1), (1, 1), (`
> Should/ Can it be break into two?
>

You are probably best suited to look for a pep8 formatter for your IDE of
choice.
Personally, I don't always format to pep8. Rather just to a consistent
style. Others will probably disagree.

You could either format this to have all your parameters on newlines:


   1. class Something(object):
   2. def __init__(self,
   3. rotate=((0, 0), (0, 0), (0, 0)),
   4. scale=((1, 1), (1, 1), (1, 1)),
   5. u_jitter=(0,0),
   6. v_jitter=(0,0)):
   7. pass


Or you could shorter the default arguments to None and handle them in the
body of your constructor:


   1. class Something(object):
   2. def __init__(self, rotate=None, scale=None, u_jitter=None, v_jitter=
   None):
   3. rotate = rotate or ((0, 0), (0, 0), (0, 0))
   4. scale = scale or ((1, 1), (1, 1), (1, 1))
   5. u_jitter = u_jitter or (0,0)
   6. v_jitter = v_jitter or (0,0)


Or you could accept **kwargs and properly document your parameters.

Justin

-- 
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/0af2c859-544f-483d-8eab-394a5ba3466d%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/0af2c859-544f-483d-8eab-394a5ba3466d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0Ln%3Dobu0%3DRJQwuZEYWfEcriZG2xw5BV79KDSdQMzeZPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to