SalladShooter / phyal

Quickly build websites without the hassle of HTML
https://phyal.vercel.app/
MIT License
34 stars 2 forks source link

Redundant self.attribute calls #28

Open Matt-DESTROYER opened 3 months ago

Matt-DESTROYER commented 3 months ago

All self.attribute calls in Tags are now technically redundant, although they could be considered useful as a guide devs to ensure they add the correct/required parameters. Should they be removed or should they stay...?

SalladShooter commented 3 months ago

We could remove them as they are redundant. But I should provide better documentation especially for devs to make things easier.

aatle commented 3 months ago

I would recommend that the Tags class and all Tag subclasses be removed since it is bad code design (inaccurate use of inheritance/subclassing). It does have benefits such as supporting default attributes, improving code intelligence, and making creating certain tags easier, so in the future it can be replaced with a module named tags with helper functions, which has similar syntax but is much more clean and pythonic:

def link(href: str = '', rel: str = '') -> Tag:
    return Tag('link', href=href, rel=rel)
...