News for hackers. Stuff that matters.
Re:Brainfuck in one line of Python by Goladus on Sunday December 04, 2011 @05:37PM (#3312105)
The goal wasn't "tightly packed" the goal was "one line."

In Python that means, essentially, one expression. That's what makes it a stunt.

Re:Brainfuck in one line of Python by vidarh on Sunday December 04, 2011 @05:42PM (#3312120)
My point with mentioning "tightly packed" was that if you'd tried to make the C version small, you'd come out with something much tinier than the 1047 bytes I mentioned.

I see he's set himself a very different goal, which is fine but not that interesting to those of us that aren't Python programmers, I guess.

What disappointed me was clicking through from a headline that seemed to indicate it'd be a tiny implementation, when it's in fact rather bloated.

Re:Brainfuck in one line of Python by ricardobeat on Sunday December 04, 2011 @07:02PM (#3312329)
In this case "one line" doesn't mean much. You could have a 1mb file in one line. Nowadays a "line" is between 80-140 characters.
Re:Brainfuck in one line of Python by rplnt on Sunday December 04, 2011 @07:50PM (#3312430)
You are not entirely right. In python, one line means something as it is only one statement (as mentioned above). Author is also strict about not using eval -- with eval you could snuck multiple lines into one line (using \n in the evaluated string).
Re:Brainfuck in one line of Python by worldimperator on Monday December 05, 2011 @03:21AM (#3313701)
Last time when I used python I could separate statements with a semicolon and put as many as i want in a line. Did that change ? ;-)
Re:Brainfuck in one line of Python by lightcatcher on Monday December 05, 2011 @03:39AM (#3313741)
This did not change, but the author also didn't use semicolons. As stated many times above, this is a single Python expression.
Re:Brainfuck in one line of Python by rplnt on Monday December 05, 2011 @06:54AM (#3314239)
I'm not sure you can write function definitions, (nested) loops and other things that rely on indentation in single line using semicolons. At least I never managed to do that.
Re:Brainfuck in one line of Python by worldimperator on Tuesday December 06, 2011 @03:42AM (#3318563)
You can do it with lambdas, but it's going to be absurdly ugly: http://blog.sigfpe.com/2008/09/on-writing-python-one-liners....
Re:Brainfuck in one line of Python by cjfont on Sunday December 04, 2011 @07:52PM (#3312437)
I reckon that the challenge involved in reducing the problem to one line (as in one single Python statement) has little to do with how many characters long it is.