What is the fundamental difference between pygame.rect.Rect() and pygame.Rect()?

I tried this and that and was surprised that both methods work and give the same result. But there must be some sense in the difference in spelling, right?

rect = pg.rect.Rect(x, y, width, height)
rect = pg.Rect(x, y, width, height)

def draw():
        draw.rect(screen, color, rect)

Upvotes: 0

Views: 279

Answers (1)

Sergius
Sergius

Reputation: 986

This is a case when you can easily dig into lib internals and investigate it on your own. In fact, there is a line from pygame.rect import Rect in pygame/__init__.py. There are no other reassignments, so there is no difference. It's just a shortcut for convenience.

Upvotes: 3

Related Questions