| Section | Video Links |
|---|---|
| Flyweight Overview | ![]() |
| Flyweight Use Case | ![]() |
| String Justification | ![]() |
... Refer to Design Patterns In Python website to read textual content.
... Refer to Design Patterns In Python website to read textual content.
... Refer to Design Patterns In Python website to read textual content.
python ./flyweight/flyweight_concept.py
abracadabra
abracadabra has 11 letters
FlyweightFactory has 5 flyweights... Refer to Design Patterns In Python website to read textual content.
python ./flyweight/client.py
-----------------------------------------
|abra | 112233 | cadabra|
|racadab | 12345 | 332211|
|cadabra | 445566 | aa 22 bb|
-----------------------------------------
FlyweightFactory has 12 flyweightsIn /flyweight/column.py, there are commands center(), ljust() and rjust() .
These are special commands on strings that allow you to pad strings and align them left, right, center depending on total string length.
eg,
>>> "abcd".center(10)
' abcd '>>> "abcd".rjust(10)
' abcd'>>> "abcd".ljust(10)
'abcd '... Refer to Design Patterns In Python website to read textual content.



