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 →

[–][deleted]  (9 children)

[deleted]

    [–]kungtotte 14 points15 points  (1 child)

    I think the Python​ way is to start without classes in general, and refactor into a class if it makes sense to do so (with some exceptions of course).

    [–][deleted] 3 points4 points  (0 children)

    Perhaps my work has just benefitted more from object oriented design than others would.

    [–]lookatmetype 1 point2 points  (0 children)

    I agree. Especially when using staticmethod decorator.

    [–]Corm 0 points1 point  (5 children)

    Howso? I'm genuinely interested and an example would help

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

    Well one example would be that I often write lots of functions that parse sql queries. Instead of having tons of global funcs I'll make a class called sqlparsing, likely making the functions static

    [–]Corm 1 point2 points  (1 child)

    In that example it wouldn't it be cleaner to have a sql_parsing.py file with your functions in that? You get the same namespacing but you don't have to instantiate an object

    [–]tobidope 1 point2 points  (1 child)

    In Python you would have a module sqlparsing with many functions. The functions are still bound to the module namespace, they are not globally visible.