Skip to content

Implementing __floordiv__ as shortcut for .descendant #6

@youtux

Description

@youtux

Hi, I think it would be quite handy to have Expression.__floordiv__ being a shortcut for Expression.descendant.
The reasoning is that it is quite common to traverse nodes using the descendant selector in pure XPath (which is //), while calling .descendant makes the code quite verbose.

IMO it would be quite convenient to be able to type

x.current('table')//'tbody'//'tr'//'td'

instead of

x.current('table').descendant('tbody').descendant('tr').descendant('td')

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions