python - Using __str__ after sorting -


i've created list using class photo , sorted list. want print string representation first 3 items in list. code i've written, end blank version of string (like "title:" instead of "title: volcano"). going wrong?

here's bit of code issue:

sorted_p = [] d in sorted(p_i, key = photo.t_c):     sorted_p.append(photo(d)) d in sorted_p[:3]:     print(d) 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -