[Tutor] global variables

Chris Down chris at chrisdown.name
Thu Aug 22 15:52:13 CEST 2013


On 2013-08-22 14:43, Matthew Ngaha wrote:
> I don't feel my program needs a class. Also i have been told to stop
> using classes by some very experienced Python programmers on irc even
> though i don't see why. It's confusing being told different things.

Well, if you want to store state, you should really be using a class. What has
made you think that your program doesn't "need a class"? There's no "need",
there's just what's best suited to your problem case (which you have not made
clear, so nobody can comment on it).

No experienced Python programmers are going to universally tell you not to use
classes, likewise, no experienced Python programmers are going to universally
tell you to use them all the time. It's a matter of context and suitability,
which is entirely dependent on what it is that you are coding in the first
place. I would doubt that anyone has told you "don't ever use classes", because
that's nonsense; you've probably misread a dissuasion from that path in a
single instance as applying more broadly than was intended.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20130822/8b858999/attachment.sig>


More information about the Tutor mailing list