[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] Moving the music module?



ShredWheat writes:
 > I'm having some second thoughts about how the music module is laid out.
 > I think the best situation is if the music module is a submodule of the
 > mixer module.

I kind of like this. Actually, I think the whole sound system is a
little weird. Consider - I want to play a sound, so I go:

       sound = pygame.mixer.get_channel()
       sound.play()

I want to play music, so I go:

       pygame.music.play()

To my way of thinking, the two actions should be congruent. Maybe:

       music = pygame.mixer.get_music()
       music.play()

Any reason why this wouldn't work? It just seems cleaner to me. I
definitely think that everything should be subordinate to the mixer.

 > 
 > A- it breaks code
 >         not really worried about that at this point, but it is considered.

:) Better now than later. I'm only halfway through rewriting 700 lines
of pySDL code.

 > B- module names getting a bit wordy
 >         this one's got me a little more concerned.

This doesn't concern me at all. Long names like this should signal to
the reader that an external library is being called - short names
start to look like local functions. Sure, people will alias things,
but they'll do that anyway - the effect on readability will be the
same in the end.

 > actually, people making their own shortcuts might be a problem as well.
 > i think handy shortcuts like that are helpful, but i'd also really like
 > everyone's code to be pretty consistent between programmers. if everyone
 > takes every pygame project and uses their own set of short module names
 > things can get a bit unclear.
 > 

Don't try to preempt our bad coding habits at the expense of API
clarity :) We'll be bad programmers, or we won't be - you can't do
anything about that. Just do what you think is right :)

David Clark
silenus@telus.net

-- 
------------------------------------------------------------------------
Look I'm sorry if I hurt you, and I'm sorry that I left
As of late it seems I'm sorry all the time
And wishing wells and shooting stars have been my friends
And I have come to realize that all the fault was mine
                                            - Bruce Guthro
------------------------------------------------------------------------

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org