u/Kaarjuus

4 post karma · 2,660 comment karma · joined Jan 2006

Kaarjuus

Safer would be

for item in long_sequence[:1]:

In case the sequence is empty.

Kaarjuus

I still remember the fatal bytes that totally crashed and froze Windows 95 if put in a .com file: FA EB FE.

Kaarjuus

I've written a savegame editor for HOMM3 where I can tweak hero skills and stats and army and artifacts.

Maybe I should get around to releasing it for public use..

Kaarjuus

An extra if-block would introduce an additional temporary variable, used only for keeping track of what a sensible for-else would provide effortlessly. It creates code clutter for a rather common requirement.

Whereas the current for-else is for an uncommon control flow, as you agree yourself. You can already do that with an if-block :) Saving code clutter should be for the more common tasks.

Kaarjuus

They really messed up with the design of that one. How for else should work, is that the else-block is entered if and only if the for-block never iterates. This is how several template engines like Jinja do it, and this is what you'd intuitively expect it to do from the name "else".

Now that would be useful, as it's a very frequent need to do something else if there was nothing to iterate. E.g. disable a listbox if it had no items to populate.

Kaarjuus

Metaclasses. Dark magic as far as I'm concerned, and I'm content to let them stay this way.

Kaarjuus

Arithmetic with unsigned numbers is highly error-prone if an intermediary result goes below zero.

Kaarjuus

It's all fun and games until the 32-bit timestamp rolls over. 18 years to go..

Kaarjuus

Very interesting. Reminds me of Sciter.

But the most important question I could not find an answer to - what does "most modern HTML5 and JavaScript features" mean exactly?

Kaarjuus
Kaarjuus

The biggest advantage is that it's easy to generate the stubs automatically. You don't have to write any code. You just say "Hey, this method is implemented remotely" and it works.

Muahaha. If only. Different platforms tend to have their own ideas about what data structures should look like - especially arrays.

Kaarjuus

The effortless manipulation of data structures: packing, unpacking, filtering, turning something from a list to a dict to whatever. In most other mainstream languages, this tends to be rather clunky.

Kaarjuus

Packaging code into an executable is essential when distributing general-purpose GUI programs, whatever language they're written in.

Kaarjuus

Twelve hours later:

191 Tkinter

108 PyQT/PySide

46 Kivy

29 PySimpleGUI

14 wxPython

9 PyGTK

Really? Who are all these Tkinter fans?

Kaarjuus

It also has a convenient Python interface: https://pypi.org/project/pdfkit/.

Kaarjuus

Because it's ugly, and error-prone, only one typo away from a comparison.

What is especially frustrating about its introduction, is that they did not go with the assignment operator already present in Python:

import foo *as bar*

except Exception *as e*: 

with open(path) *as f*:

So an assignment operator already existed, yet they ignored it and introduced completely new syntax instead. Not only does this go against the Zen of Python, it is poor engineering.

And what is especially egregious, is how Guido rage-quit his position as project lead over opposition to this, but not before forcing the change through using his position. I lost a lot of respect for him as a result.

Kaarjuus

Unfortunately, you're not wrong.

The peer-to-peer core that it used to have, created by the BlueMoon guys, was solid gold - same engine that powered Kazaa. And their work on audio codecs has been excellent. Everything else around it, though..

This timestamp problem - the commendation of one of Skype lead devs was that I install SQLite and fix the messages manually.. Nice. The same guy also saw no problem with Skype popping up EAccessViolation errors.

Kaarjuus

It's not reliably monotonous - system clock can be changed any which way.

Kaarjuus

I remember when Skype used to order chat messages by local timestamp at the time of reception. So if at one point your clock was wrong, say a year in the future, then even after adjusting it, all those future-stamped messages continued to be the last messages visible in a chat. Made Skype basically unusable.

A number of my friends worked at Skype, and it was incredibly frustrating how they actually argued that it's not a problem when I reported it.

Edit: Or more exactly, they argued that it's the only possible choice since Skype was peer-to-peer.. As if decades of research in distributed systems had not already solved this in a number of ways.

Kaarjuus

Or you could do this:

import json
import urllib

try: jdata = json.load(urllib.request("http://api.example.com/v1/status"))
except Exception as e: exit(e)
Kaarjuus

Most people seem to use requests just for the convenient API.

Myself, I've also never needed or wanted to pull it as a dependency. For basic needs, urllib is as convenient and concise as requests.

Kaarjuus

bottle - a single-file drop-in web framework with a template engine, beautifully suited for many projects. Flask is often an overkill, not to mention Django.

step - Simple Template Engine for Python, a handy 135-line template class that I've used in a number of projects where stuff like Jinja is an overkill.

Kaarjuus

Please please do! This is exactly what that sub is for, and it would solve this current situation beautifully. Everybody who want to see other projects, can look at them there, leaving r/python for news and non-beginner questions and technical discussions.

It should be featured prominently on the sidebar as well. Maybe also create a link for a combined r/python+madeinpython, for those who do want to get the same content that r/python has today.

(Small note: r/learnpython should maybe also be in the "related subreddits" list, in addition to its top spot in the sidebar, for a comprehensive list.)

Kaarjuus

Nope, it's the moderators. They made the change a few months back to introduce flairs to encourage people posting their scripts, and as a result the forum has become noise.

It was rather good before that change.

Kaarjuus

Maybe they've changed for good now, but such fuckery is EXACTLY what they have engaged in before. Like deliberately blocking all browsers other than IE from Microsoft sites, following with even more nefarious targeted sabotage: https://en.wikipedia.org/wiki/History_of_the_Opera_web_browser#First_MSN.com_controversy