Re:Show HN: Forbidden Fruit – Patch built-in Python objects
by prezjordan on Wednesday April 03, 2013 @06:12PM
(#5489563)
Probably for the same reason why reopening Ruby classes is used so much. "hello, world".capitalize looks nicer than capitalize("hello, world"), and it's more convenient for method chaining.
I just used my default licence template, which defaults to GPL.
A very quick test would be trying to do something like this:
>>> monkeypatch(str, "blah", "bleh") >>> assert str.blah == "bleh"
I tried it here with no success though.
A wonderful hack! :)
Edit: see https://github.com/clarete/forbiddenfruit/blob/master/forbid...
1) Making it easier to write tools for testing python code, like sure[0] and freezegun[1]
2) Prototyping new features for python without touching the C code.
[0] http://github.com/gabrielfalcao/sure -- where forbiddenfruit started) [1] http://github.com/spulec/freezegun