Question

I have this class:

class Point(PointAbstract):
    """
    Class used to expand shapely.geometry.Point functionality
    """

    def __unicode__(self):
        return '%s, %s' % (self.x, self.y)

    def __repr__(self):
        return '%s, %s' % (self.x, self.y)

    def __str__(self):
        return '%s, %s' % (self.x, self.y)

When I try to evaluate an instance through ipdb I get:

> /home/...
    151         p = Point(float(each[4]), float(each[3]))
--> 152         for i, _each in enumerate(headers):
    153             if not _each in headers_to_ignore:

ipdb> p
*** SyntaxError: SyntaxError('unexpected EOF while parsing', ('<string>', 0, 0, ''))

I would expect something like:

123.0, 321.0

What am I missing?

Was it helpful?

Solution

p is a pdb command to print values (short for print), and Python expects an argument to that command.

It is not interpreted as the name p. Use either:

ipdb> p p

to tell p(rint) to print the object p, or escape the reference:

ipdb> !p
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top