Skip to main content
8 events
when toggle format what by license comment
Apr 6, 2015 at 21:17 comment added Peter Ah ok thanks for the tips. For the record, Maya is a 3D program, so instead of building upon the classes or whatever, you use the inbuilt functions mixed with normal python to do the program specific things. I've just been building the user interfaces inside it because they're an awful lot more easy to do than from what I've seen of tkinter :)
Apr 6, 2015 at 17:02 comment added Veedrac @Peter In situations like that, it's pretty much whatever you think works best. Personally I would use camelCase when extending Maya (eg. superclasses or wrappers of their stuff) and use snake_case elsewhere but I've never seen Maya, never mind used it.
Apr 6, 2015 at 16:29 comment added Peter Ahh nice one, I wasn't aware of .startswith(), that looks an awful lot more efficient to use. As to the mixed capitals, I think me using them comes from doing all the python inside Maya (and I'd missed the bit that said it's only for backwards compatibility). All the Maya commands are things like, pm.polyAverageVertex, pm.defaultNavigation etc, and I've only recently branched out into doing non-Maya things with python. What would your suggestion on that be then, bearing in mind I'll usually finish non Maya code like this, but then build a UI in Maya to make it easier to use?
Apr 3, 2015 at 15:46 comment added Veedrac @Peter For the len part, you don't need it. Just call len in the all. In fact, you can just do all(not strip_line.startswith(x) for x in fixed_names). That's the only place you'd use the len. // "With pass, I think it'd solve that by adding it to fixedNames" → That doesn't solve it; it could be any other single statement instead. // "mixed capitals seems ok with PEP8" → PEP 8 says "mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility." I'm certain that the convention is snake_case.
Apr 3, 2015 at 15:08 vote accept Peter
Apr 3, 2015 at 15:06 comment added Peter With the bugs, thanks for pointing them out, I hadn't realised not all triple quoted bits were just comments, and likewise, I hadn't thought of putting ''' inside """ or vice versa. With pass, I think it'd solve that by adding it to fixedNames (I forgot about it to be fair), plus I've only ever seen @classmethod and @staticmethod so the others didn't cross my mind, all I'd need to do is make sure anything starting with @ doesn't get moved :) As to the first point you made, the mixed capitals seems ok with PEP8, and I think they look a bit neater than underscores
Apr 3, 2015 at 15:01 comment added Peter Sorry it took a while, but thanks so much for the feedback, it's been really useful reading through lol. I've started trying to document functions and classes now, and breaking up the longer lines (if they break up nicely - if it's a long string I'll leave it). The len part is needed later on to check only the start of the string, since otherwise, if I had print "if", it could still detect it as an if. With mixing ' and ", it was to try detect which was first, so it wouldn't affect the other one if it occured in a string.
Mar 28, 2015 at 13:15 history answered Veedrac CC BY-SA 3.0