Hacker News new | ask | show | jobs
by pekk 4479 days ago
Tuple unpacking:

  t = (1, 2)
  a, b = t
  # a == 1 and b == 2
Using slices is normal with lists
1 comments

Cool like this,hope implement in php. No need to explode
PHP has the list construct which is a little uglier, and has a couple of odd behaviors

    php > $t = array(1, 2);
    php > list($a, $b) = $t;
    php > echo "$a, $b";
    1, 2