6 ms·
We talked a bunch about this. Python and JS are the two most common languages we see on our site, and Python has slightly more compact syntax, which works well
by ammon 9y ago
We talked a bunch about this. Python and JS are the two most common languages we see on our site, and Python has slightly more compact syntax, which works well in the questions. The idea, however, was not to require any python-specific knowledge. Which question do you think is looking at syntax?
- bussierem 9y agoHey, not the GP, but just glancing through the quiz - Question 3 focuses on the fact that Python passes things by reference to functions. This is definitely specific to the two languages you guys use (as is your prerogative), but if you're expanding this for others, you should definitely explain that these focus on the JS and Python languages.
- ammon 9y agoGood point. I think that objects are passed by reference in a high enough % of language in common use (PHP and C++ are the two exceptions I can think of) that this is a fair question. But if enough people think it's bad, we'll remove it.
- macintux 9y agoEvery functional programmer in the world is looking at you askance.
- marcosdumay 9y agoYou got me on that too. A high enough % of the languages pass stuff by value (C/C++), copy on assignment (C++, D, I'm sure there are more), or do not have the concept of references or changes to start with (Prolog, Haskell). Anyway, if you want to bias it into Python, go for it. It's a fun quiz.
- Bartweiss 9y agoCopy on assignment was what got me, and I didn't feel terribly bad for missing it. No harm done though, seeing as nothing was riding on the quiz.
- rodovich 9y agoAdditionally, question 2 amounts to "what is the usage of python's queue class", question 4 requires knowing whether array indexes start at 0 or 1 in python, and question 8 amounts to "what is the usage of python's bytearray class".
- philh 9y agoI'm not sure that's fair about question 2. It's hard to say because I know python (but not the deque class), but none of the incorrect answers seem like they'd be correct in any sensible language. Like, whatever language you're using, you need to push the children of the current node on to the queue. Only one answer looks like it could reasonably do that.
- Bartweiss 9y agoYeah, agreed. Question 2 as asked demanded Python knowledge, but once you checked against the answers provided it seemed much clearer that 3 options were invalid.
- freyr 9y agoAlso, strictly speaking, Python is not "pass by reference" as the term is used for other languages. It's more accurately "pass by object" or "pass by object reference." Somewhat of a pedantic distinction, and the quiz question is clear regardless. [1] http://robertheaton.com/2014/02/09/pythons-pass-by-object-reference-as-explained-by-philip-k-dick/ http://robertheaton.com/2014/02/09/pythons-pass-by-object-re... [2] http://foobarnbaz.com/2012/07/08/understanding-python-variables/ http://foobarnbaz.com/2012/07/08/understanding-python-variab... [3] https://jeffknupp.com/blog/2012/11/13/is-python-callbyvalue-or-callbyreference-neither/ https://jeffknupp.com/blog/2012/11/13/is-python-callbyvalue-...
- vitno 9y agothey didn't say syntax, they said Python idiosyncrasies. Knowing move/copy rules in python counts as that. It's something that isn't intuitive unless you know python, ex: the matrix question. An experienced dev who isn't a python person would pick the intuitive choice, see the matrix is malformed, then Google how to clone objects in python.
- safek 9y agoOn the other hand, how many languages do you know where arrays are passed by value?
- macintux 9y agoMy primary language (Erlang) does. I assume all functional programming languages do.
- safek 9y agoThat's true. I suppose my next argument is that seeing matrix.append(row) on its own line signals strongly that this is not a functional language.
- thedufer 9y agoIs that true? I thought most functional programming languages did call-by-reference. I mean, if you have immutable data you can't tell the difference (outside of performance).
- macintux 9y agoUnder the hood it's probably by reference, but the semantics are by value. By reference indicates that the original value can be changed in the called function. I think. Not a language lawyer.
- echevil 9y agolol, the same mistake can be made in a lot more languages~
- acconrad 9y ago> The idea, however, was not to require any python-specific knowledge But the quiz specifically mentions on multiple answers that "In Python, unlike language X, Y, Z" OR "In Python, like [similar language] A, B, C"...I mean this says nothing about my programming ability, this says whether I know the quirks of the language in the same way that I can tell you all the quirks of JavaScript but not in Python. This to me is not a programming quiz, but a Python quiz designed to determine how much someone knows about what can go wrong in Python.
- ammon 9y agoWell, the questions get into other things too.(Character encoding, timing attacks, graph algorithms.) Writing a good single-paragraph description of iterative deepening depth-first search was a challenge!
- acconrad 9y agoYeah except that character encoding question assumes I know how Python handles bytearrays. That trick answer of "it will break" threw me for a loop because I needed language-specific knowledge about the types that Python could handle for that input. And then with timing attacks - I mean SQL Injection is a fair web security question to ask someone, but the timing is like, very fringe knowledge. Most devs let their framework handle all of those kinds of things. Not sure why I would need to know this unless I was specifically in the sec world. The last 3 questions were actually general CS because they went through search trees and shortest paths algos, which are language-agnostic.
- deleted 9y ago[deleted]
- bdcravens 9y agopopleft is shift in many other languages. Not all languages manipulate arrays in the same way re ref/value. Not all languages have the concept of range() - you could have used a simple array to be more language agnostic. (I'm sure I could have found more, but I'm Python isn't a language I spend much time in)
- d0100 9y agoI only did the first 3 , but both 2 and 3 focus on python-specific names (extend(), queue) and pass-by(reference/value).
- tobyhinloopen 9y agoI used many programming languages - C, C++, Java, Ruby, Elixir, C#, Swift, Objective-C & Javascript. I've never used Python.
- deleted 9y ago[deleted]
- GrinningFool 9y agoQ2: THis isn't a syntax thing, but it does require knowledge of python queue objects to get right Q3: This requires knowledge around the semantics of argument passing, which vary from language to language. Q4: this again requires some understanding of how values are stored. Some languages will copy, while others will use a reference to the originally inserted value. Q5: python closure syntax. python scoping rules. Q8: unless you know what "bytearray.decode" does, the best you can do is make an educated guess from the context.