Jas Singh Jas Singh - 1 year ago 60
Python Question

How can i break up this line to meet PEP8 requirements?

I am getting a 'Line too long error' in the PEP8 online checker for the 'category' attribute. My piece of code is as shown :

class A:
__tablename__ = 'items'

category = relationship(Category, backref=backref('items', cascade='all, delete'))
id = Column(Integer, primary_key=True)

Answer Source

How about

class A:
    __tablename__ = 'items'

    category = relationship(Category, 
                            backref=backref('items', cascade='all, delete'))
    id = Column(Integer, primary_key=True)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download