Profile cover photo
Profile photo
Luke Plant
202 followers
202 followers
About
Posts

Post has attachment
Luke Plant commented on a post on Blogger.
Hi Steven,

To me, most of your post (link for G+ http://slott-softwarearchitect.blogspot.co.uk/2017/06/another-problems-with-python-list.html ) represents a fundamentally wrong attitude in responding to language criticism. Like Dan, I love Python, but also basically agree with all his criticisms. Your response sounds like "stop complaining, there is no problem". That's really not helpful in terms of getting Python to make progress. To give some examples on specific points:

1. Your solution is to write in C instead of Python. If your response to a "this language is deficient" argument is "use another language", then you are agreeing with them. If your response "use C", then you are making the persons argument for them extremely forcefully. If we wanted to write in C, we would be doing that already, and we really don't want to, for all the reasons you already know. Every time we have to do so, we are indicating a failure in Python. We should admit that.

2. Other languages have good solutions to parallel programming in a single process, and programmers don't need to make a mess of things using threads. Python does not. That is the point Dan was making.

5. "That would be hard, we can't do that well, therefore you shouldn't want to have it" - this is not a real response.Then you do another "use a different language" response again. You are agreeing with Dan! This is the first time I heard about Coconut, it looks really tempting, but there are lots of reasons why I might not choose it - the fact that I only just heard of it is one.

6. Why should I have to add a metaclass? Plus, even with things like `attrs`, which is the best implementation I've seen of that kind of metaclass, I still can't do the things I need to with a readable syntax. Plus I've now got to ensure that people on the project understand the extra layer that `attrs` adds.

7. `elif` is a horrible substitute for pattern matching.

For example, under 6 and 7, the other day I wanted something like the following ADT (using Haskell syntax):

data TokenCheckResult =
    ValidToken | InvalidToken | ExpiredToken RetryInfo
    deriving Read, Show, Eq

...

foo =
    ...
    case doCheckResult someArgs in
        ValidToken -> doSuccessThing
        InvalidToken -> doFailureThing
        ExpiredToken info -> doRetryThing info

There is simply no decent way to write this in Python. There are multiple ways you might try, none of them truly terrible, but certainly none of them nice. You end up with ugly `isinstance` checks, or data structures with unused fields, and boilerplate every way. You also have to do `import attrs` just to get something approaching `deriving Read, Show, Eq`, and you then have to buy into `attrs` which involves rewriting at some level.

And the lack of a standard way to do this very simple thing means there are always multiple solutions (bad in itself), instead of a direct way to use a type/data structure to express something.

And then there is no compiler help to make sure you didn't miss any of the options.

All of these are valid criticisms, and reasons why `elif` just doesn't cut it.

(By the way, this comment box doesn't work on Firefox, at least on Linux)
Add a comment...

Post has attachment
Add a comment...

Help! It seems I've forgotten the passphrases on my id_rsa/id_dsa files. However, something has remembered them (ssh-agent?), and must be unlocking these files for me, because I can happily use these files for logging in to other machines. I'm using Gnome and ssh-agent. I don't normally have to do anything other than log in to be able to use my id_rsa file.

So how do I persuade my computer to produce unprotected versions of id_rsa/id_dsa, or the passphrases on them?
Add a comment...

The simplest thing that will actually work.

In programming, I basically agree with "do the simplest thing that could possibly work". But too often, I see "do the first stupid thing that comes into your head". These things are not the same.

We've recently bought a house. We quickly found that the electric shower fuses after 10 minutes of use. It turns out that it has been connected to a socket circuit, instead of having its own high amperage circuit. The process probably went like this:

* Well, there are some wires here, which are live, and not too far away. Let's try them!
* Turn it on  - yay it works!
* Wiring a house properly is hard, let's go shopping!

Of course, the test didn't ensure that it would continue working after 10 minutes, or that you have a system that isn't going to burn your house down. Tests only ever test that something works in one particular instance, in an extremely narrow set of conditions, not that it is robust or correct.

"Do the simplest thing that could possibly work" is fine for coming up with possible solutions. And a test can help prove something is viable. But that is just the beginning! Tests do not begin to show that your code is correct - you are actually going to have to think for that.

Find the simplest thing that will actually work.

Post has attachment
Romanesco broccoli - from Morrisons! I had seen pictures of this before, but not in real life. The fruit and veg section in Morrisons is quite cool these days.
Photo
Add a comment...

Post has attachment
This seems like a good case for "let's not add any more verbs to HTTP", or, "if we had a time machine, we'd go and tell the past not to  add so many".

Or "I'm only going to use GET and POST".

But to actively remove things that are already understood and widely used (even if you personally don't use them, and even if they are a fraction of GET+POST in terms of quantity), and would cost millions to replace, seems to require much stronger justification.  And there are things like OPTIONS which really don't translate well into either GET or POST.
Add a comment...

Post has attachment
Why is PEP8 important ,even down to whitespace around punctuation

?For the same reasons that most' normal 'people will get tripped up reading this paragraph

.Technically ,there 's nothing I'  m writing that can 't be deciphered-there 's no absolute reason behind traditional conventions

-

but they are conventions, and sticking to them helps reading to flow!

So, all I want to do is get my last photo from my instagram feed, using the API, and a script. This requires getting an access token for OAuth2 authentication, and a ridiculous amount of work AFAICS.

Note this is my feed (OK, my clients, but still a single known user, for whom I have username and password). The script will run on a server completely automated, so a solution involving manual prompts or browsers is out of the question. The script needs to keep working not just once.

The only solution I've seen is this:

Start off the process using a browser to get an initial access token and refresh token, storing these in a DB and refreshing as necessary.
http://stackoverflow.com/questions/9809742/how-to-automate-login-to-google-api-to-get-oauth-2-0-token-to-access-known-user

So you have to start with a browser (which is failure already), and then you need a persistence mechanism as well?

I am missing something major, or is this insane? There is no programmatic way to get an access token in OAuth2?

I heard OAuth2 was bad, but surely not that bad?
Add a comment...

Post has attachment
Idea: for DRM systems like Amazon's kindle which allow remote deletion etc., the seller should be forced by law to describe purchases as 'renting' and not 'buying'.  Could this work?

Or is it possible that Amazon is already guilty of violating things like the UK Trade Descriptions Act by failing to be clear about this?

http://www.bekkelund.net/2012/10/22/outlawed-by-amazon-drm/
Add a comment...

Post has attachment
Haven't laughed so much in a while: Feel Inside (And Stuff Like That) - Flight Of The Conchords (Red Nose Day 2012) [Lyrics]

You can skip to about 4:35 if you don't know the Flight of the Conchords
Add a comment...
Wait while more posts are being loaded