This tag is used for questions about similarities between any of various programming constructs. Comparisons include correspondences between API, functionality, syntax, features, methodologies and the like.
Questions tagged [equivalent]
369 questions
21
votes
2 answers
TypeError: list indices must be integers or slices, not list
array = some kind of list with 3 columns and unlimited amount of rows with data inside of it.
Volume = array[0][2]
counter = 0
for i in array:
if Volume == array[i][2]: #<------ why is this line a problem?
counter += 1

Michael
- 223
- 1
- 2
- 8
20
votes
9 answers
Python Equivalent to Ruby's #each_cons?
Is there a Pythonic equivalent to Ruby's #each_cons?
In Ruby you can do this:
array = [1,2,3,4]
array.each_cons(2).to_a
=> [[1,2],[2,3],[3,4]]

maxhawkins
- 878
- 6
- 18
19
votes
2 answers
A clearcase equivalent of svn blame / git blame?
In Rational Software's Clearcase, is there a cleartool subcommand, or other command line tool, equivalent to the blame command in SVN or in git?

sarat
- 10,512
- 7
- 43
- 74
16
votes
2 answers
Python equivalent of Ruby's each_with_index?
In Ruby, if I have an array and I want to use both the indexes and the values in a loop, I use each_with_index.
a=['a','b','c']
a.each_with_index{|v,i| puts("#{i} : #{v}") }
prints
0 : a
1 : b
2 : c
What is the Pythonic way to do the same…

AShelly
- 34,686
- 15
- 91
- 152
15
votes
4 answers
Is pass-by-value/reference equivalent to making a deep/shallow copy, respectively?
To reword the question in case someone types it into the search bar differently:
Is pass-by-value the same as making a deep copy, and is pass-by-reference the same as making a shallow copy?
If not, what is the difference? In Python, the language I'm…

Matthew Milone
- 184
- 1
- 9
15
votes
4 answers
Pure JavaScript equivalent of jQuery click()?
I am building a small app which captures mouse clicks. I wrote the prototype in jQuery but, since it is a small app focusing on speed, embedding jQuery to use just one function would be an overkill.
I tried to adapt this example from…

hoball
- 3,146
- 5
- 23
- 15
13
votes
2 answers
Objective C equivalent to Java's ArrayList
Just wondering if there is an equivalent to Java's ArrayList in Objective-C?
Or something that can be used to store objects/data that does not have a set size.
Thanks.

Julio
- 6,182
- 11
- 53
- 65
12
votes
5 answers
How to know if all the cells have the same value in some column
How to know if all the cells have the same value in some column (title changed)
I want to have a bit scalar value that tells me if all the values in a column equal something:
DECLARE @bit bit
SELECT @bit = TRUEFORALL(Name IS NOT NULL) FROM…

Shimmy Weitzhandler
- 101,809
- 122
- 424
- 632
11
votes
3 answers
Is there anything like /proc for windows
I'm Curious about 2 things,
What is the closest equivalent to /proc that ships with windows
Are there any products which add a proc like filesystem to windows?

Roman A. Taycher
- 18,619
- 19
- 86
- 141
11
votes
4 answers
Java Equivalent to iif function
the question is simple, there is a functional equivalent of the famous iif in java?
For example:
IIf (vData = "S", True, False)
Thanks in advance.

seba123neo
- 4,688
- 10
- 35
- 53
11
votes
1 answer
Java Regular Expressions equivalent to PCRE/etc. shorthand `\K`?
Perl RegEx and PCRE (Perl-Compatible RegEx) amongst others have the shorthand \K to discard all matches to the left of it except for capturing groups, but Java doesn't support it, so what's Java's equivalent to it ?

rautamiekka
- 251
- 2
- 14
11
votes
5 answers
JS equivalent of jQuery .is()
Is there a pure JS equivalent of jQuery .is() on modern browsers?
I know there is the querySelector method, but I want to check the node itself, rather than finding child nodes.

Petah
- 45,477
- 28
- 157
- 213
11
votes
5 answers
Scala equivalent of Python help()
I'm proficient in Python but a noob at Scala. I'm about to write some dirty experiment code in Scala, and came across the thought that it would be really handy if Scala had a function like help() in Python. For example, if I wanted to see the…

Ray
- 7,833
- 13
- 57
- 91
10
votes
3 answers
Java: Can I use two different names in an enum to count as the same thing?
I have an enum class with the cardinal directions(North, East, South, West):
public enum Direction {
NORTH,
EAST,
SOUTH,
WEST;
}
Is there a way to be able to use multiple names for the same thing? For example something like…

Pithikos
- 18,827
- 15
- 113
- 136
9
votes
4 answers
equivalent CreateGraphics in wpf
So, I've used winForms .CreateGraphics to draw a variety of different things, from lines to boxes to images. It was very snappy and responsive.
I am trying to learn WPF in C#
I found that WPF allows me to "add" rectangle objects to a canvas which…

ohmusama
- 4,159
- 5
- 24
- 44