You have to try it!
class Pizza(Fields.name.size): pass
>>> Pizza("Pepperoni", "large") Pizza(name='Pepperoni', size='large')
class Pizza(Fields.name.ingredients.crust.size): pass
>>> Pizza("Funghi", ["mushrooms", "mozarella"], "thin", "large") Pizza(name='Funghi', ingredients=['mushrooms', 'mozarella'], crust='thin', size='large')
Before we consider this for inclusion in the standard library ...
„Don't speak around saying that I like it.”
”Are Python programmers that lazy?” --Some Java developer
„Is it some Ruby thing?”
„WHAT?!?!”
„I don't think it should work ...”
class Pizza(Fields.name.crust["thing"].size["large"]): pass
>>> Pizza("Funghi", crust="thick") Pizza(name='Funghi', crust='thick', size='large')
https://github.com/ionelmc/python-fields
Sorry!
| Just because you can | 1 |
|---|---|
| Just because you can | 2 |
| Would this be possible? | 3 |
| How about this? | 4 |
| But ... | 5 |
| What would normal people say | 6 |
| And last ... | 7 |
| Shameful plug | 8 |
| Table of Contents | t |
|---|---|
| Exposé | ESC |
| Full screen slides | e |
| Presenter View | p |
| Source Files | s |
| Slide Numbers | n |
| Toggle screen blanking | b |
| Show/hide slide context | c |
| Notes | 2 |
| Help | h |