Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Regular Expressions in Python Introduction to Regular Expressions Players Dictionary and Class

Philip Ondrejack
Philip Ondrejack
4,287 Points

Player Dictionary - What is the end result?

This challenge felt good to accomplish. However, I can't see the exact point of using __init__because we weren't passing anything into Player. Could you explain what we were doing exactly?

When we set the Player class we set it without an argument. I was expecting to pass players into it so that the attributes would be set based on whatever argument players was taking in.

Would the Player class have access to the regex pulls without taking players as an argument and players being set to compile and then calling players on the data variable?

It seemed too easy to go in and do the standard __init__ attribute setting. It's possible that I'm missing something very simple so this may look foolish but it hasn't hit me so I thought I would toss it out there.

By the way @KennethLove, you are the man for being as active as you are in the forums. You have a great teaching style. I'm not far from being done the Python track and I'm wishing you were doing a second "advanced" Python track.

1 Answer

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Well, you don't create Players from it, but I do :) My validation of that code challenge uses your regex-created dictionaries to create instances of your class that are checked for the right attributes and values. Basically, you're doing what I mentioned doing at the end of the videos.

Thanks for the compliments! We're gonna keep adding things to the Python track and a Flask track isn't far off. Even scarier (for me), we're about to start on Django. I'll keep making 'em, you keep learning.