Questions tagged [timtowtdi]

There Is More Than One Way To Do It.

There Is More Than One Way To Do It. A motto of the Perl community, which is sometimes used by the Ruby community as well.

The Zen of Python gives the opposite philosophy: "There should be one – and preferably only one – obvious way to do it."

9 questions
20
votes
19 answers

What constitutes effective Perl training for non-Perl developers?

I've been working with Perl long enough that many of its idiosyncracies have become second nature to me. When new programmers join our group, they frequently have little to no experience with Perl, and it's usually my task to train them (to the…
Adam Bellaire
  • 108,003
  • 19
  • 148
  • 163
18
votes
8 answers

Summing the previous values in an IEnumerable

I have a sequence of numbers: var seq = new List { 1, 3, 12, 19, 33 }; and I want to transform that into a new sequence where the number is added to the preceding numbers to create a new sequence: { 1, 3, 12, 19, 33 } --> {1, 4, 16, 35, 68…
Ritch Melton
  • 11,498
  • 4
  • 41
  • 54
15
votes
3 answers

What are the pros and cons about declaring package version methods in Perl?

Modules are cool especially when they come with versioning. You can define minimum module version to prevent leak of methods you want to use. But with every light side there comes a dark side which means Perl's TIMTOWTDI. After nearly seven years as…
burnersk
  • 3,320
  • 4
  • 33
  • 56
12
votes
9 answers

Why are there so many slightly different ways to do the same thing in Ruby?

I am learning Ruby. My background is C++/Java/C#. Overall, I like the language, but I am a little confused about why there are so many different ways to accomplish the same thing, each with their own slightly different semantics. Take string…
Ryan Michela
  • 8,284
  • 5
  • 33
  • 47
8
votes
1 answer

How to get List consisted by repeated items in Perl6?

I try to use: (^10).map({0}) to generate a list with 10 '0'. Is there another way to do it?
Sun Wenjie
  • 123
  • 6
5
votes
13 answers

Is there some way to make variables like $a and $b in regard to strict?

In light of Michael Carman's comment, I have decided to rewrite the question. Note that 11 comments appear before this edit, and give credence to Michael's observation that I did not write the question in a way that made it clear what I was asking.…
Axeman
  • 29,660
  • 2
  • 47
  • 102
4
votes
3 answers

"In Ruby there's more than one way of doing the same thing" - what does this mean?

Feel free to delete this topic if it's discussed or quite obvious. I hail from C# background and I'm planning to learn Ruby. Everything I read about it seems quite intriguing. But I'm confused over this basic philosophy of Ruby that "there's more…
nawfal
  • 70,104
  • 56
  • 326
  • 368
2
votes
4 answers

What is the value in having several, equally abstract, syntactic variations for coding something?

I am currently reading up on Ruby. I think it is a nice language, but I am a bit bothered by having so many equivalent ways, that are only slightly different in syntax, for coding the same action. For example, the unless conditional statement, which…
Anas Elghafari
  • 1,062
  • 1
  • 10
  • 20
0
votes
0 answers

Parsing CLI arguments: switches vs. #!/usr/bin/env perl shebang (again)

My case at hand An overgrown one-liner with 10 -sswitch-powered arguments, that I desire to put into a file script whith /usr/bin/env-powered shebang. 10 arguments make me wish for a straightforward solution. Problem In a one-liner you can use -s…
uxer
  • 521
  • 3
  • 10