Live data from Hacker News

Anyprint: use any language's print statements in Python

github.com

71–76 of 76 posts

Re: Anyprint: use any language's print statements in Python

#71

Ironically, what I miss most from Python is Python2's print, which for a language proud of getting rid of parenthesis, that is very contradictory....

> for a language proud of getting rid of parenthesis Er… what? Python doesn't have braces, it has plenty of parenthesis. In fact, Python 3 added more since it upgraded several keywords to functions (not just print but also exec, and some forms of re-raising)

Little known fact: The addition of `exec`-with-parenthesis actually long predates Python 3. Python 3 just removed the old, braceless version.

That this is so little known is why we have a complicated future.exec_, which is entirely needless! (https://stackoverflow.com/a/26098101/1763356)

Re: Anyprint: use any language's print statements in Python

#72
post #71

Earlier quoted context omitted.

> for a language proud of getting rid of parenthesis Er… what? Python doesn't have braces, it has plenty of parenthesis. In fact, Python 3 added more since it upgraded several keywords to functions (not just print but also exec, and some forms of re-raising)

Little known fact: The addition of `exec`-with-parenthesis actually long predates Python 3. Python 3 just removed the old, braceless version. That this is so little known is why we have a complicated future.exec_, which is entirely needless! ( https://stackoverflow.com/a/26098101/1763356 )

> Little known fact: The addition of `exec`-with-parenthesis actually long predates Python 3. Python 3 just removed the old, braceless version.

That's not really true, although the syntactic compatibility does make for conveniently trivial cross-compatible code, Python 3 did not "remove the old, braceless version" it converted exec from a keyword (which could accept a single tuple parameter) to a builtin function (which takes up to 3 parameters). Which had the side-effect of requiring parenthesis.

Incidentally, the print-tuple-trick is cute, I hadn't considered it.

Re: Anyprint: use any language's print statements in Python

#74
post #71

Earlier quoted context omitted.

Little known fact: The addition of `exec`-with-parenthesis actually long predates Python 3. Python 3 just removed the old, braceless version. That this is so little known is why we have a complicated future.exec_, which is entirely needless! ( https://stackoverflow.com/a/26098101/1763356 )

> Little known fact: The addition of `exec`-with-parenthesis actually long predates Python 3. Python 3 just removed the old, braceless version. That's not really true, although the syntactic compatibility does make for conveniently trivial cross-compatible code, Python 3 did not "remove the old, braceless version" it converted exec from a keyword (which could accept a single tuple parameter) to a builtin function (wh…

Yes, I explained badly. I appreciate the clarification.

Re: Anyprint: use any language's print statements in Python

#75
post #64
post #4

Makes all these valid in Python: printf("printf %d\n", 10); fmt.Println("hello") cout Really funny, including the testimonials: > Anyprint has many glowing reviews from its many satisfied users: > > * "omg pls" > * "what is wrong with you" > * "That's stupid and not useful." > * "Please add my testimonial: "very accurate testimonials"." > * "kragniz, please stop writing questionable python metamodules :v"

> cout For the love of god, please stop using endl. It performs a flush when "\n" is both valid and all that you ever want. Also what happened to the std:: prefix?

Are you saying you never want to flush?

If flushing after every line is good enough for printf then it's gonna be good enough for me~

Re: Anyprint: use any language's print statements in Python

#76
post #64

Earlier quoted context omitted.

> cout For the love of god, please stop using endl. It performs a flush when "\n" is both valid and all that you ever want. Also what happened to the std:: prefix?

Are you saying you never want to flush? If flushing after every line is good enough for printf then it's gonna be good enough for me~

Buffering of Cs stdout is implementation defined. For Linux it is only line buffered in an interactive terminal session and fully buffered otherwise.

> Are you saying you never want to flush?

90% of the time not. The other ten percent include asking for user input, which causes an implicit flush since std::cin is linked to std::cout, and debugging an ugly heisenbug.

Post reply on HN