Skip to content

Pointwise multiplication and division #5

@serindonnelly

Description

@serindonnelly

Pointwise multiplication and division are common operations, and it would be useful to have concise syntax for them. For instance:

tile_size = Vector(8,16)

tile = Vector(4,5)
screen_pos = tile_pos * tile_size # = Vector(32, 80)

click_pos = Vector(35,82)
click_tile = click_pos // tile_size # = Vector(4,5)

/ and // are available for this purpose, but * is currently in use by the dot product. Repurposing * for pointwise multiplication would make the library usage line up nicely with NumPy, but would make a nasty surprise for anyone relying on the dot product who was unaware of the change. Perhaps ** would be an acceptable alternative?

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