Replies: 2 comments 1 reply
-
You can actually do those actions right now because the values returned are array of classes and you can iterate over the array. box_score = league.box_scores(4)
for item in box_score:
home_roster = item.home_lineup
for player in home_roster:
player.player_name Making a class iterable gives you the ability to iterate over objects in a single class. Right now I do not see a huge advantage to this because most of the fields you will want to reference individually. However if there is a use case it could be something added. |
Beta Was this translation helpful? Give feedback.
-
I was asking because I can't seem to do this actually -- when I try I get errors like this: |
Beta Was this translation helpful? Give feedback.
-
Do you have any plans to make your classes iterable? For example. I'd love to be able to do
box_score = league.box_score(4)
for item in box_score:
home_roster = item.home_roster
for player in home_roster:
print player.player_name
This would be possible if you overrode iter and next in your custom classes, or am I wrong?
D.
Beta Was this translation helpful? Give feedback.
All reactions