pycairo icon indicating copy to clipboard operation
pycairo copied to clipboard

Default arguments for cairo.Context.arc

Open carlosgmartin opened this issue 5 years ago • 3 comments

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.

carlosgmartin avatar Apr 01 '20 23:04 carlosgmartin

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 avatar Nov 21 '22 20:11 lazka

@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).

carlosgmartin avatar Nov 21 '22 23:11 carlosgmartin

@lazka This Sourcegraph query can give some idea of how common it is to use arc to just draw a circle.

carlosgmartin avatar Feb 25 '23 05:02 carlosgmartin