Techniques to extend code without modifying it? (besides modules and decorators)

Christian Seberino cseberino at gmail.com
Wed Apr 29 12:54:28 EDT 2020


>
> a pattern like:
>   if <pattern_1>: <handle_pattern1>
>   elif <pattern_2>: <handle_pattern2>
>
>

Thanks.  I really like this simple yet powerful suggestion you made.  See
this...

import new_code
...
if foo:
    new_code.do_new_stuff(..)

We can massively modify existing code by *ONLY* adding one import and a 2
line if snippet!!!

Very nice!

cs


More information about the Python-list mailing list