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

this is why bugs exist

Name: Anonymous 2006-09-11 16:24

The reason why bugs exist in software amounts to one word (well technically two):

BRAINFARTS

look at this... I didnt catch this for a whole hour in my code:

Vector3D Vector3D::add(Vector3D vect)
{
    Vector3D v;
    v.x = x * vect.x;
    v.y = y * vect.y;
    v.z = z * vect.z;

    return v;
}


;_;

I'm not even drunk or high.  Why the shit did I do this?  i must be stupid

sigh

Name: Anonymous 2006-09-12 23:54

For read-only, you can do a shortcut using decorators. It goes like this:
class Example:
    def __init__(self):
        self._text = "foo bar"
    @property
    def value(self):
        return self._text
If you want to be able to both read and write:
class Example:
    def __init__(self):
        self._text = "foo bar"

    def _getValue(self):
        return self._text
    def _setValue(self, value):
        self._text = value
    value = property(_getValue, _setValue)

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