Created
July 17, 2010 14:36
-
-
Save tswicegood/479549 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QuickOutputter(object): | |
def __lt__(self, msg): | |
print msg | |
return self | |
o = QuickOutputter() | |
o < "Some random message" | |
o < "Some other message" |
your way of printing doesn't support redirection the print statement has
print >>sys.stderr, "Some random message"
generally, i think this only makes the code harder to read, rather then making it "more concise"
@superbobry: yup - not trying to mimic the print >>sys.std*
syntax. The idea would be that you call log.set_default_output
for a printer, then do o.stderr < "something"
or log.warn < "omg!"
.
Agreed - concise doesn't always make more readable - just trying to see what the thoughts where out there on this style.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
o < "neat"