osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Design: method in class or general function?


Ben Finney wrote:
> leam hall writes:
> > 
> > I've wrestled with that discussion for a while and Python
> > 3 loses every time.
> 
> The context of the thread you started was that you are a
> *newcomer* to Python. Now you say you've considered Python
> 2 versus Python 3 many times? What explains that apparent
> contradiction?

The OP said: "OOP newbie on Python 2.6" and "Sorry about
being unclear earlier, coffee was still kicking in and I'm
still a newbie that mixes up terms." From my POV, both
quotes are referring to OOP, not Python.

> > There's literally no good reason for me to move to Python
> > 3 earlier than mid-2020's. Please accept the fact that
> > there are hundreds of thousands of servers, if not
> > millions, running Python 2.x.
> 
> The servers can continue to run Python 2.x to support
> existing programs. That doesn't go against the advice
> given.  The advice is that Python 3 is today the best
> choice for a Python *newcomer*, and for writing *new* code
> such as in the example which started this thread.

Not all "new code" requires the features of Python3. Are
lazy iterators going to make or break "new code"? Is the
print function going to make or break "new code"? Is the
removal of some little used modules or features from Python2
going to make or break "new code"? Possibly!

> > Whether or not Python 3 has any neat cool stuff is
> > irrelevant to those of us seeking to use Python to get
> > today's work done.

*EXACTLY*!

> If today's work *only* involves maintaining existing Python
> 2 legacy programs, go right ahead.  That role will only
> shrink, though, so it's not a good thing to learn today.

Total BS. There is nothing about Python2.x that is
preventing a programmer from writing good, modern code.
Python is nothing but a tool, and only a poor craftsman
blames his tools for his own incompetence.

> For people learning Python, or for writing new programs in
> Python, it is best to avoid the dead-end Python 2
> altogether and use the current version of Python 3.

Just because you and Steven have decided to follow the
Python3 religion, does not mean everyone else should follow
along blindly. You have made your emotional appeal for
Python3 and the OP has rejected your appeal, and now it's
time for you and Steven to accept the reality that people
have the freedom to choose whichever tool works best for
_them_, not for _you_.