As well as if (false && existing_condition) to quickly remove blocks of code! (Mostly in view templates - Not as much when Block comments are available from editor
Prototyping or debugging, sure, but it shouldn't be committed like this, because it just looks like a mistake (like there was a real condition, someone replaced it with "1" to test something, then forgot to change it back). I don't find it necessary to leave something like this, but if it is, there should at a minimum be a comment at the top to explain why.
It does more than just printing. I removed some lines from the picture. But isn't if 1, always a true case. I extracted this code from production only and this is a live script.
Python is as real as it gets. I use it daily while talking with others .
if 1:
cursor = con_redshift.cursor()
cursor.execute(query)
records = cursor.fetchall()
rows = cursor.rowcount
body = f"Clinic Rating Data Export Finished. {rows} Rows Exported"
print(body)
else:
# except:
body = "Clinic Data Export Not Finished Successfully "
They do have a point though, perhaps there could be a bot that does a preliminary transcription and puts at the top "This automatic transcription has not yet been verified by a human" and then a human could check it and approve/edit it.
Apart from code other images that include texts - e.g., chat messages, forum threads, reddit posts, etc. - have special formatting for things like usernames and date/times and OCR would easily screw that up. The subreddit r/TranscribersOfReddit does have an OCR bot that aids with human transcription IIRC.
147
u/littlelowcougar Jan 29 '23
I do this all the time when I want to quickly enable/disable chunks of code whilst prototyping or debugging.
2
u/[deleted] Jan 30 '23
🤦♂️ Use 🤦♀️ A 🤦 Real 🤦♂️ Language 🤦♀️
C
This prevents debug code from leaking to production.
25
u/HeWhoShantNotBeNamed Jan 30 '23
This was probably for debugging.
48
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jan 29 '23
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
23
u/paulohbear Jan 29 '23
Maybe they aliased 1 to be a an environment variable? 🤣🤣🤣
15
u/[deleted] Jan 29 '23
Just glad they left the comment otherwise I wouldn’t understand that else block
15
u/Cervarl_ Jan 29 '23
Maybe in the space it causes a different behavior
4
u/Da_Viper Jan 29 '23
What Font is this
3
u/redoverture Jan 31 '23
Looks to me like someone thinks this will behave like try except
2
u/[deleted] Jan 30 '23
In my bash script there is
```
if false
then
LEFT=DP-2
MAIN=HDMI-2
RIGHT=HDMI-1
else
LEFT=DisplayPort-1
MAIN=HDMI-A-1
RIGHT=HDMI-A-0
fi
```
Because i don't know why, sometimes my outputs names change
-16
u/[deleted] Jan 29 '23
Its obviously fake code.