Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror

Comment: Re:It depends (Score 1) 486

by 31eq (#49340009) Attached to: No, It's Not Always Quicker To Do Things In Memory
The simple way to do it in Python is

>>> import time
>>> import random
>>> chars = [chr(random.randint(0,255)) for each in range(1000000)]
>>> stamp=time.time(); joined=''.join(chars); time.time()-stamp
0.11153912544250488

So that's 1/9 of a second on a not very fast laptop. You can try it yourself. Obviously not as fast as C++ but not horrible.

Comment: Re:Such potential (Score 1) 520

by 31eq (#49061061) Attached to: Nim Programming Language Gaining Traction

Types certainly matter, and Python has types. Yes, feeding the wrong type into a function probably won't work. It'll raise an exception and you'll see a traceback that helps you to fix your code.

If you want to check the types that are supplied to a function, you can do it with assertions. You can even go further and check the things going in have the properties you want. Type checks are a crude form of precondition. A function that expects a tuple will probably work with a list. A function that works with an iterable can accept a whole load of types without all the constipation of an explicitly coded interface to declare for all of them.

If you want the type errors picked up before you execute the code, you might be in luck. You could use the assertions, although I don't know of any tools that do this. There's also a convention for type specifications in docstrings. And official support for function annotations:

https://www.python.org/dev/pep...

None of which addresses static typing as such, which says that after assigning an integer to a variable, you shouldn't be able to reassign it as a float.

There are, still, real advantages to static typing and languages that give you those benefits with type inference, so you don't have to put type declarations all over the place. There are also languages with better generics than void * in C or Object in Java. (C++ and Java are even two of them). Mixing the good features of Python with a good static typing system would certainly be a good thing.

Oh, and I've been programming for a good deal longer than 20 years. I can appreciate different languages for working in different ways.

Comment: Re:What was it? (Score 1) 129

by 31eq (#49002387) Attached to: CrunchBang Linux Halts Development

It's Debian with a coherent desktop built around Openbox, and an installer, and maybe some other choices different to the Debian defaults. It uses the Debian repositories as well as its own and even declares itself "Debian GNU/Linux" when you SSH in.

I happen to prefer the LXDE desktop now I can turn the bits I don't want off. I can understand the argument that Crunchbang isn't as important as it was. But enough people will prefer the Crunchbang style that they'll keep it going with a different name.

Comment: Re:My FreeBSD Report: Four Months In (Score 1) 471

by 31eq (#48973337) Attached to: Systemd Getting UEFI Boot Loader
There is a standard for starting a service when you log in:

The autostart specification defines a method for automatically starting applications during the startup of a desktop environment after the user has logged in and after mounting a removable medium.

http://www.freedesktop.org/wiki/Specifications/autostart-spec/ Obviously, desktops could still do with a better way of starting services and making sure they stay running. Because that wouldn't be at all useful on servers or anything.

Comment: Re:Jesus, we're fucked. (Score 1) 351

by 31eq (#48899659) Attached to: Americans Support Mandatory Labeling of Food That Contains DNA

I have a vague memory of the DHMO project being about the presentation of science in the media, rather than public ignorance. It showed how people will get the wrong idea if you portray a scientific issue badly. Ironically, this story has been hideously portrayed in the media. We're told that 80% of Americans support labeling of food containing DNA, which is much the same as 80% of Americans supporting food labeling, which is an obviously good idea, so you wonder what the other 20% were thinking. But oh, no, let's make fun of these people who fell for a ludicrous scam without actually explaining what was ludicrous about it.

Comment: Re:Better way? (Score 1) 289

by 31eq (#48749513) Attached to: Extra Leap Second To Be Added To Clocks On June 30

The trouble is, the Internet is standardized on UTC. You can keep your system clock to TAI and use the "right" time zone files, but you have to deal with the offset between your clock and NTP, and the complexity of NTP broadcasting the leap second as it happens. (Or forego the convenience of NTP altogether, of course.)

There should be an RFC to decree that for networking purposes, we'll ignore this and future leap seconds and keep "Internet UTC" as a fixed offset from TAI. People who care about strict UTC (and it would, apparently, cost millions of dollars to fix critical military systems) can use libraries or time zones to get it. The rest of us will know our system clocks keep ticking away with minimal breakage.

What will probably happen is that we follow the leap second again, things break again, and any impetus to fix the underlying cause dies away by the time the next leap second comes around. And eventually UTC will be defined as consistent atomic time and the people who wanted UTC for what it was originally designed for will have to learn to call it something else.

Uncompensated overtime? Just Say No.

Working...