Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python classes?

Name: Anonymous 2011-02-12 21:56

Let's say I have the following code in Python:


class dong():
   x = None
   def __init__(self):
      pass
   def dat_func(self):
      print x.upper()


We know that Python is dynamically typed. So I can change the type of the class member x at run-time when ever I want. That means that for every method in a python class where you have code that depends on the type of the class member x you have to check the integrity of x such that the type of x is what you want it to be.

This code demonstrates the problem.
[code]
x = dong()
x.x = 10
x.dat_func() #error, dat_func expects a str object.

For every fucking class member, any time you want to use it . . . You have to check the type to remind retarded developers that they're wrong.

Now if Python had private members it would be easier, but it fucking doesn't.

Prog 1, Python 0.

Name: Anonymous 2011-02-12 23:41

>>9
Let's not have another fucking thread about autism. Enough with the autism. It's a /b/ fad or something. It's nothing to do with us.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List