HN user

Xephyrous

139 karma
Posts0
Comments25
View on HN
No posts found.

PayPal froze my account a few years ago for "suspicious activity". I still don't know what that activity was. Support gave me the same sort of runaround non-answers as described in this article. I finally got to talk to someone on the phone and had an exchange along these lines: me: "Is there any way I can continue to use paypal?" paypal: "You can open up a new bank account and then use that to register a different paypal account" me: "..."

It used to be that way, now when I try it F1 is a sign-in screen, F2 is my main GUI, F3-F6 are normal virtual terminals, and F7 is some process that I don't recognize.

Classes definitely give you a lot of rope to hang yourself with (metaclasses, inheritance, MULTIPLE inheritance), but they have their place. I'll usually start with a function, but when it gets too big, you need to split it up. Sometimes helper functions is enough, but sometimes you have a lot of state that you need to keep track of. If the options are passing around a kwargs dictionary, and storing all that state on the class, I know which I'd pick.

You can memoize methods to the instance to get lazy evaluation, properties can be explicitly defined up-front, and the fact that everything is namespaced is nice. You can also make judicious use of @staticmethod to write functional code whenever possible.

"Don't let people pay for things because poor people might not be able to afford it" is offensive to "poor" people.

It's important to distinguish what kind of "things" you're talking about, though. There's a pretty big moral difference between not being able to afford consumer goods and not being able to find an appropriate place to perform basic bodily functions.

Why do you want to work at one of the big 4 tech companies? Software engineering is a very big field, you don't need to be really good at solving coding puzzles on a whiteboard to be a good developer. Hell, there are developers who do nothing but set up wordpress sites for their clients, and they're providing a needed, valuable service.

You can work as a web dev at a small company without being part of the mainstream silicon valley rat race. Sysadmin-type skills are pretty hard to hire for, and very useful at small companies. It sounds like you've got that going for you. I'd change your definition of success and focus on finding a job at a company with a culture you'd enjoy, and not worry so much about its perceived prestige.

I'd write that function like this:

  def absolute_path(path):
      if not path.startswith('/'):
          return '/' + path
      return path
This way you don't have to keep track of mutating the path variable. I do find that more readable - it's clearer that there are two paths through the code. That said, this example is trivial enough that I'd probably do it with an inline if/else statement, although still probably not a lambda:
  def absolute_path(path):
      return path if path.startswith('/') else '/' + path
This way it's more obvious at a glance that you're defining a function. It's easier to follow someone else's code if they generally adhere to standards, and Python is a very convention-oriented language.

Neovim however might help to solve this problems, but when that will see the light of day, it seems to be hard to find out.

Neovim is working quite well already. I fully switched from vim to nvim months ago without any issues. Plugins are still written for vim though, so I don't think many take advantage of neovim-specific features yet. It does have a full terminal already though, which is pretty awesome.

edit: Oh, I'm guessing you're referring to the promises of embedding neovim inside IDEs. I'm looking forward to that too!

Why Lisp? 11 years ago

ipython has a killer autoreload function: http://ipython.org/ipython-doc/stable/config/extensions/auto...

In [1]: %load_ext autoreload

In [2]: %autoreload 2

In [3]: from foo import some_function

In [4]: some_function()

Out[4]: 42

In [5]: # open foo.py in an editor and change some_function to return 43

In [6]: some_function()

Out[6]: 43

It's nothing like a proper lisp repl, but you can sorta do this in vanilla python too, if you don't mind some annoyances. `reload` reloads a module:

>> import mymodule

>> print mymodule.myfunction()

3

>> reload(mymodule)

>> print mymodule.myfunction()

5

Downside is you have to use the module, `from mymodule import function` won't reload.

I've been using spacemacs off and on for a few months, (although never as my primary editor). I really like their out-of-the-box config, and it's much easier and better than my previous copypasted amalgamation of an init.el file. I have a few qualms with it though.

- It completely takes over emacs. Your modifications now go in ~/.spacemacs. Don't touch ~/.emacs.d/ Want to install something from melpa? Make a spacemacs configuration layer. That aspect feels like a strong step away from the emacs ethos where you're on the same footing as the editor authors. I don't like the inversion of control.

- It's unstable. Fairly often I'll update and something will fail, leaving me helplessly with emacs keybindings. Thankfully, a revert is easy.

- The last one is a problem with evil in general, you'll still occasionally find yourself in emacs mode, where hjlk and more importantly ":q" don't work

Spot on critique. Two additions:

What about pure carnivores? Surely their food doesn't want to be food, but carnivores do just fine.

While I agree that the amount of corn we eat is absurd, to call it inedible is ludicrous. Raw corn on the cob is plenty edible, and sweet corn is quite tasty, although that's admittedly not what's grown on large corn plantations.

I'm having a lot of fun with this. I'll submit something soon. You swallow all exceptions and make the robot guard instead. This is nice, but it makes it hard to develop, because you can't see what went wrong. Here's a way you can modify it to have your exception and eat it too:

from http://docs.python.org/2/library/traceback.html#traceback-ex...

In game.py, at the top, put

    import sys, traceback
and around line 285, replace this:
    except Exception:
        next_action = ['guard']
with this:
    except Exception:
        print "The robot at (%s, %s) raised an exception:" % robot.location
        print '-'*60
        traceback.print_exc(file=sys.stdout)
        print '-'*60
        next_action = ['guard']

That makes your robot a lot easier to debug. Awesome game, have you thought about putting it on github so people can submit patches?

Is there any way to access the map in the Robot class? For the default map, I can just hardcode it, but if you do intend for a robot to be playable on multiple maps, they'll need some way of knowing which squares are obstacles and spawn points. Without preserving state between turns, there's no way to figure that information out over time, either.

Looks fun, can't wait to get started. In your instructions, you said to run the program, call:

    python kit/run.py yourcode.py yourothercode.py --render
If you try to run run.py from outside of its directory, it can't import settings.py
    Traceback (most recent call last):
      File "kit/run.py", line 1, in <module>
        import game
      File "/home/<name>/robotgame/kit/game.py", line 30, in <module>
        settings = SettingsDict('settings.py').d
      File "/home/<name>/robotgame/kit/game.py", line 28, in __init__
        self.d = AttrDict(ast.literal_eval(open('settings.py').read()))
    IOError: [Errno 2] No such file or directory: 'settings.py'

The nomenclature invites unnecessary confusion, as the terms are all already used ("How many simple seconds are in an actual second?").

Why not use metric prefixes on a day to come up with the names? This requires no new definitions, just a new application of existing terminology.

simple hour = deciday

simple minute = milliday

simple second = 10 microdays