Open yunline opened 5 days ago
yes
I consider these deprecated already, they're not documented or anything. Are you proposing to add deprecation warnings on their use? If so, how? They are not as straightforward to add a warning to as a function.
I think removing them would be good for 3.0
CameraType
EventType
FontType
JoystickType
MaskType
SoundType
ChannelType
RectType
FRectType
(what?)SurfaceType
These
*Type
s has a long history. You can find them since the first commit of pygame on github. They are aliases of the original type object and are not recommended to use.What are
*Type
used for?Before python 2.3, there is no
tp_new
slot inPyTypeObject
struct. People use a function to "new" a class defined by c extension.Take
Event
as an example, at that time,EventType
is the type of event, people need to callEvent()
function, to create anEventType
object.After python2.3, API changed, people no longger need a explicit function to "new" a class
Again, take
Event
as example, now people only need to callEventType()
to create anEventType
objectTo keep the compatibility of the code written before python 2.2, the
Event
become the type name andEventType
become an alias. People can still callEvent()
to get anEvent
object.These could explain why there are so many
*Type
in pygame.Deprecate and remove
These aliases are created to keep the compatibility with python 2.2, whose last release is on 30 May 2003. Today is 25 Nov 2024, we are currently dropping python 3.8 and porting modules to SDL3. So, why not?