Due to lack of gotos, this is the shortest way I can come up with to tell python to keep doing something until it actually works (in my case, loading a webpage) is this:
tempvar = 1
while tempvar == 1:
try:
<stuff that will either work or cause an exception>
tempvar = 0
except:
pass
EXPERT PROGRAMMERS already know any potential scenarios during which an exception will be generated, and thus, try-catch-goto is inefficient and for fucking BEGINNERS.
Name:
Anonymous2011-04-23 0:52
that's the best way to do it, friend.
Name:
Anonymous2011-04-23 0:56
he uses exceptions in c++
fucking java programmers
RAII is preferred over explicit exception handling in C++ due to the nature of how stack unrolling is implemented.
Furthermore, you should never use exception handling to communicate an expected error state such as an HTTP 404 response on an HTTP socket connection--that should be handled by return codes in C++.
Name:
Anonymous2011-04-23 1:42
>>6
First of all, bitch, it's STACK UNWINDING, not fucking stack unrolling. You stupid fuck. Second, I WILL FUCKING USE EXCEPTIONS ALL I WANT. I WILL USE THEM 20 TIMES PER FUNCTION AND NEST TRY BLOCKS OVER 9000 TIMES. YOU CAN FUQIN SUCK MY DICK, CUNTFAG, GODFUCKINGDAMN.
>>7
You're free to use what you want, but you should keep in mind that exceptions are very slow, especially if used for mundane stuff. Common exception implementations will eventually thunk to kernel mode and cause context switches. If you use a debugger, multiply that slowdown by another large amount. Exceptions are not lightweight (compared to their local equivalent: goto).
THis doesn't mean that error handling should be performed by goto, just that exceptions should not be used to pass mundane non-abnormal behavior information around, especially if it's something you do often.
>>7
It's people like you who are the cause of all of today's bloatware. Go get fucked.
Name:
Anonymous2011-04-23 1:55
>>7
Exceptions? Like "out of place calls?"
out of normal run-time?
Dood, optimise your thinking. Go take some LSD. or some E. Seriously. It helped me expand my programming boundaries. I'm not BSing you.
AND also you could simply use FUNCTIONS? Maybe? Will that help? Or use Classes if applicable? I think both of those are avail in C++ (topic)?
Name:
Anonymous2011-04-23 1:56
Speaking of Topic- >>1
You're doing it wrong. Feed the data of the loaded page TO python via pipes. :) .
You want to make sure it's really actually E that you're taking tho! You're, sadly enough, safer taking LSD probably. :) :D ... MADE IN THE USA, MOFOS! HAHAHhahahaa :D
"Don't use exceptions for expected conditions" always sounds a lot like "we didn't really design for exceptions so if you throw one you'll probably crash the program / leak memory / corrupt data, so only do it if you pretty much have to crash anyway". Is there any justification for this ‘principle’?
Name:
EVER SINCE2011-04-23 2:04
Ever since they killed the site WAY BACK WHEN with the user reviews of pills, there has been no safe look-up to know what press is worth a shit. LET ME Clarify that- don't take Extasy now bkus u cannot verify it (short of using strips - use your own strips you can verify :).
>>9
I do? How? My software is pretty fast and lean. I even warned the person what are the pitfalls when using exception handling, especially native one. >>10
I don't even know what you're talking about. >>12
Huh? You have to try harder 0/10. Why would I be upset about what other people choose to do with their own code, especially if I'm not the one working on it? back to /b/.
Name:
Anonymous2011-04-23 2:12
>>19
Then WRRRYYYYYY r u evn ON here?
Yes ---- to /b with u! :P
Name:
Anonymous2011-04-23 3:11
I use exceptions and setjmp all over the code, because C++ doesn't allow continuations and I hate it. The more problematic C++ programs are, the sooner C++ will die. If you hate your language, write the worst code possible.
Name:
Anonymous2011-04-23 3:14
Also, I've `map` and `fold` functions in C++. They return their result using circular buffers of global variables and take macros instead of lambdas, so no need for GC.
Name:
Anonymous2011-04-23 3:17
For a greater effect I preprocess C++ code with `m4` and `sed`.If it was hard to write it should be hard to understand.
>>24
In fact, if you look at the runtime source code for your favourite functional language, you'll see that many of them use the same underlying OS specific fiber APIs to implement continuations.
Name:
Anonymous2011-04-23 3:23
BTW, never use templates because #define is enough.
Name:
Anonymous2011-04-23 3:25
even better: never use #define, just copy-paste expanded versions everywhere.
Name:
Anonymous2011-04-23 3:27
>>28
If somebody ask you, what the hell are you doing, just say that you havent noticed similiarities.
Name:
Anonymous2011-04-23 3:30
And never use functions where you can inline them into single big routine of 10 pages of code. I once wrote a 2000 lines C++ program consisting of a single main() with a bunch of gotoes (work like continuations!).
Name:
Anonymous2011-04-23 5:44
>>16
It's a script to gather data that's going to have to run for days. Whether it crashes or hangs forever trying to continuously reload a page doesn't really make a difference. At least if it keeps trying there's a chance it'll come back to life.
>>36
What part of "I'm not a pythonist" is too hard for you to comprehend? Or do you just like to make yourself feel better by trolling randomly?
Python sucks; we all know that. There's no need to piss on me for making a simple suggestion.
Name:
Guido van Rossum!GO9STjdhn2!LeWQGdzAW+mR5bL2011-04-23 7:04
>>38
I was just pointing out the remarkable quality of the boilerplate Python forces you to write for a so-simple task.
I'm sorry if you took that as an insult to your person, I'm sure you're a respectable member of our society that works hard to make the world a better place, my comment was not meant to offend you!
Name:
Anonymous2011-04-23 11:20
YOU CAN STEAL MY FARTS, BUT YOU CAN'T STEAL MY GNUFREEDOM!