HNHacker News
TopNewBestAskShowJobs

hchasestevens

197 karma · joined February 17, 2013

https://github.com/hchasestevens
submissionscomments
hchasestevens··on Python decorators they won't tell you about
http://nbviewer.jupyter.org/github/hchasestevens/posts/blob/...
hchasestevens··on Artificial Intelligence Uses Videogame Footage to Recreate Game Engine
Imagine this paired with a system like the one Bret Victor demos in "Inventing on Principle" [0] or in "Stop Drawing Dead Fish" [1], in which the user hand-animates what they want the game movement/overall gameplay to look like, adjusting as necessary. The system described in this paper could get you a decent way from that hand-animated mockup to a working game that looks and feels first and foremost like you intended, rather than working from a playable-but-bad-feeling prototype game engine and having to endlessly adjust to get the game feel "right".

[0]. https://youtu.be/PUv66718DII?t=29m20s [1]. https://youtu.be/ZfytHvgHybA

hchasestevens··on Reducing Python's startup time
This is, in fact, the exact reason for the _source attribute which is being discussed in this article - you can use namedtuple to easily create a structure, get its source, and then edit it to suit your individual project needs. E.g.:

  >>> from collections import namedtuple
  >>> FullName = namedtuple("FullName", "forename surname")
  >>> print(FullName._source)
  from builtins import property as _property, tuple as _tuple
  from operator import itemgetter as _itemgetter
  from collections import OrderedDict

  class FullName(tuple):
      'FullName(forename, surname)'

      __slots__ = ()

      _fields = ('forename', 'surname')

      def __new__(_cls, forename, surname):
          'Create new instance of FullName(forename, surname)'
          return _tuple.__new__(_cls, (forename, surname))

      @classmethod
      def _make(cls, iterable, new=tuple.__new__, len=len):
          'Make a new FullName object from a sequence or iterable'
          result = new(cls, iterable)
          if len(result) != 2:
              raise TypeError('Expected 2 arguments, got %d' % len(result))
          return result

      def _replace(_self, **kwds):
          'Return a new FullName object replacing specified fields with new values'
          result = _self._make(map(kwds.pop, ('forename', 'surname'), _self))
          if kwds:
              raise ValueError('Got unexpected field names: %r' % list(kwds))
          return result

      def __repr__(self):
          'Return a nicely formatted representation string'
          return self.__class__.__name__ + '(forename=%r, surname=%r)' % self

      def _asdict(self):
          'Return a new OrderedDict which maps field names to their values.'
          return OrderedDict(zip(self._fields, self))

      def __getnewargs__(self):
          'Return self as a plain tuple.  Used by copy and pickle.'
          return tuple(self)

      forename = _property(_itemgetter(0), doc='Alias for field number 0')

      surname = _property(_itemgetter(1), doc='Alias for field number 1')
You can then pretty simply remove the inheritance from tuple and change the properties to get the behavior you describe.
hchasestevens··on Multi-Task Learning in Atari Video Games with Emergent Tangled Program Graphs
There are actually lots of very exciting GP applications! One of my favorites is "Fixing 55 out of 105 bugs for $8 each", in which GP is used to automatically repair code: https://www.cs.virginia.edu/~weimer/p/weimer-icse2012-genpro... . They've also achieved better-than-human level results in antenna design for NASA ( https://ti.arc.nasa.gov/m/pub-archive/1244h/1244%20(Hornby).... ) and in discovering novel quantum computing algorithms ( http://faculty.hampshire.edu/lspector/pubs/GP-quantum-GP98-w... ).

I'll also shamelessly hock here my GP framework for Python, in case you're interested in experimenting: https://github.com/hchasestevens/monkeys

hchasestevens··on Invisible unicorns: Big companies that started with little or no money
Skyscanner
hchasestevens··on English is weirdly different from other languages
In terms of morphological complexity, at least, it falls closer to creoles than any other major European language: http://www.lingref.com/cpp/wccfl/26/paper1657.pdf (see page 74).
hchasestevens··on Esoteric programming paradigms
Is there any chance that you'd ever open-source the original Aurora demo? Seems like it would be a great foundation for further exploration in this space.
hchasestevens··on I bought my daughter heroin
Do consider that, in many places in the U.S., anti-drug programs deliver the same ruinous message about all drugs, regardless of their actual dangerousness or potential to harm. When the children exposed to this rhetoric discover that drugs are not uniformly lethal - oftentimes through experimentation - this has the effect of undermining fundamentally the messaging they've heard (while also serving to discredit the person who warned them in the first place - often a police officer or other authority figure).
hchasestevens··on Graphviz in the browser
Definitely. Jupyter makes it very easy to display SVG, which graphviz (naturally) targets out of the box - as an example, I've used this before in a project to display Python ASTs ( https://github.com/hchasestevens/show_ast ).
hchasestevens··on Web Scraping in 2016
A small counterpoint to this -- in the airline industry, it's relatively commonplace for seat reservations to be made for a user _before_ payment has occurred. In this case, if you're mirroring normal browser activity, you can (temporarily) reduce availability on a flight, potentially even bumping up the price for other, legitimate users, and almost certainly causing the airline to incur costs beyond normal bandwidth and server costs. I'm sure there are many other domains for which this is also the case, however rare.
← PreviousPage 2 of 2