Slashdot Mirror


User: fjolliton

fjolliton's activity in the archive.

Stories
0
Comments
3
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 3

  1. Re:Why Ruby? on Ruby 1.9.0 Released · · Score: 1
    Have you tried it?

    >>> a = { 1 : 2 }
    >>> b = { ( 'foo' , 'bar' ) : 4 }
    >>> c = dict( a , **b )
    >>> a , b , c
    ({1: 2}, {('foo', 'bar'): 4}, {1: 2, ('foo', 'bar'): 4})
  2. Re:Why Ruby? on Ruby 1.9.0 Released · · Score: 1
    With Python (>=2.4 I think):

    >>> a = { 'x' : 3 }
    >>> b = { 'y' : 7 }
    >>> c = dict( a , **b )
    >>> a , b , c
    ({'x': 3}, {'y': 7}, {'y': 7, 'x': 3})
    To merge more than 2 dictionnaries this way, you need dict(dict(a, **b), **c), and so on.
  3. Re:Why Ruby? on Ruby 1.9.0 Released · · Score: 1
    Using Emacs, editing Python code with correct indentation is not difficult. I use a lot the following keybindings:

    ;; Functions to shift a region. Useful for Python.
    (defun region-shift-left ()
    (interactive)
    (if mark-active
    (indent-rigidly (region-beginning)
    (region-end)
    (- (or current-prefix-arg 1)))))

    (defun region-shift-right ()
    (interactive)
    (if mark-active
    (indent-rigidly (region-beginning)
    (region-end)
    (or current-prefix-arg 1))))

    (global-set-key (kbd "A-<left>") 'region-shift-left)
    (global-set-key (kbd "A-<right>") 'region-shift-right)
    Select the block to shift, then alt-right arrow or alt-left arrow to indent/unindent the block. Very convenient! And it just work after pasting. I can't imagine editing Python code without these bindings.