pycairo
pycairo copied to clipboard
Default arguments for cairo.Context.arc
In my experience, cairo.Context.arc is much more often than not used to draw full circles. I think adding default values for the angle arguments, namely angle1=0 and angle2=2*pi, would make such code more concise and readable.
Sorry for the late response.
hm, I don't really see why a full circle would be "the default". Doesn't that depend on what you are trying to do and what type of problem you are solving?
We also have proper inline documentation now, including examples: https://github.com/pygobject/pycairo/blob/5f65487ad8d4ead9bc9d3fe9caf0a4656e6da535/cairo/init.pyi#L2377 so hopefully it should be easier to use with a proper IDE despite having to pass many arguments.
@lazka I think the most common use of arc is drawing a circle. It can be helpful to have defaults that match the most common use case. An alternative would be adding a circle function that calls arc with the right parameters. Saves users a bit of trouble (e.g. importing pi).
@lazka This Sourcegraph query can give some idea of how common it is to use arc to just draw a circle.