Top "Idioms" questions

A programming idiom is the usual and customary way to write code in a particular language.

Ruby idiom for substring from index until end of string

Just wondering if there's a Ruby idiom for extracting a substring from an index until the end of the string. …

ruby string substring slice idioms
What is the idiomatic way to slice an array relative to both of its ends?

Powershell's array notation has rather bizarre, albeit documented, behavior for slicing the end of arrays. This section from the official …

arrays powershell slice idioms language-comparisons
In what contexts do programming languages make real use of an Infinity value?

So in Ruby there is a trick to specify infinity: 1.0/0 => Infinity I believe in Python you can do something …

python ruby language-agnostic idioms infinity
What is a programming idiom?

I see the phrase "programming idiom" thrown around as if it is commonly understood. Yet, in search results and stackoverflow …

language-agnostic idioms
ddply + summarize for repeating same statistical function across large number of columns

Ok, second R question in quick succession. My data: Timestamp St_01 St_02 ... 1 2008-02-08 00:00:00 26.020 25.840 ... 2 2008-02-08 00:10:00 25.985 25.790 ... 3 2008-02-08 00:20:00 25.930 25.765 ... 4 2008-02-08 00:30:00 25.925 25.730 ... 5 2008…

r multiple-columns plyr idioms split-apply-combine
Alternative to the `match = re.match(); if match: ...` idiom?

If you want to check if something matches a regex, if so, print the first group, you do.. import re …

python idioms
What is the "Execute Around" idiom?

What is this "Execute Around" idiom (or similar) I've been hearing about? Why might I use it, and why might …

java language-agnostic design-patterns idioms
Common Ruby Idioms

One thing I love about ruby is that mostly it is a very readable language (which is great for self-documenting …

ruby idioms
LBYL vs EAFP in Java?

I was recently teaching myself Python and discovered the LBYL/EAFP idioms with regards to error checking before code execution. …

java python error-handling idioms
How do I manipulate $PATH elements in shell scripts?

Is there a idiomatic way of removing elements from PATH-like shell variables? That is I want to take PATH=/home/…

unix shell idioms path-variables