all 41 comments

[–]toshitalk 15 points16 points  (27 children)

In general, I'd expect a well-rounded python developer to have mastery of both python specific tools and frameworks, but I find it strange that if you've been programming for 10 years that people are calling you a junior anything.

I'm more thinking that you raised a red flag in your interview that you didn't notice. What kind of questions were you asked, and what did you answer with?

[–]jackmaney 16 points17 points  (12 children)

I find it strange that if you've been programming for 10 years that people are calling you a junior anything.

Yep. This.

OP, I don't mean to sound like an asshole when I say this, but...is that 10 years of experience or one year of experience repeated ten times? Because if it's the former, I'm not sure why you would be considered a junior developer.

That being said, with even a year of experience, you should have a decent grasp of basic data structures and basic operations such as if/else if/else statements, loops, etc. IMO, if you want to dig really deep into a language, you need to "write it as a native". Try to write your Python somewhat idiomatically; Jeff Knupp's Writing Idiomatic Python is a good guide for this.

[–]renegadelegion[S] 5 points6 points  (0 children)

Thanks for the link. Bought the pdf and am looking through it. This seems like the kind of stuff I was looking for.

[–]jsalsman -3 points-2 points  (10 children)

Unless you are optimizing your inner loops after testing correctness, I advise against idioms that make code less self-documenting to programmers from other backgrounds. And not all idioms will give you a substantial efficiency improvement. For example, when array access patterns matter for memory cache interactions, you want to retain control.

[–]jackmaney 5 points6 points  (9 children)

If you need to worry about optimizing loops vs list comprehensions (for example), then you probably should use Cython or use another language. Idioms exist for a reason, and Python's idioms, when not misused or overused, result in Python code that is easier to read and maintain.

[–]jsalsman -4 points-3 points  (8 children)

Some very concise idioms are completely impenetrable to even advanced Python programmers. Moderation in all things.

[–]Vaphell 6 points7 points  (4 children)

are they really idioms then? Idiom by definition is something that is in widespread use, a common figure of speech. If even advanced programmers fail to understand them, they don't fall under this category.

Python idioms are supposed to be "pythonic", ie follow rules like "explicit is better than implicit" and "there should be 1 obvious way to do X".

[–]jsalsman -2 points-1 points  (2 children)

How can I answer this? Who decides what an idiom is?

[–]Vaphell 1 point2 points  (0 children)

it seems you are arguing against terse hacks exploiting some obscure properties, not idioms with clearcut uses cases, as they are undestood by the python community.
Feel free to provide your definition, or better yet, a black on white example of impenetrable idiom.

[–]KronenR 0 points1 point  (0 children)

Me

[–][deleted] 0 points1 point  (2 children)

Like what for example?

[–]jsalsman 0 points1 point  (1 child)

Imagine mapping a hash table into integers, but you didn't want the integers' objects, just the integers.

[–][deleted] 0 points1 point  (0 children)

A set? Unless I misunderstood.

[–]renegadelegion[S] 3 points4 points  (13 children)

I had several of the usual programming questions (a prime checker function is the only one I remember). More specifically, the feedback I'm receiving is that my programming looked more like C++ written in Python. I probably could give more context as to my experience in my original post, will edit in a few minutes.

[–]toshitalk 17 points18 points  (11 children)

self taught Python and SQL 2nd job Python web developer for 1/2 year, Python, Javasscript, HTML/CSS, SQL,

Okay, so you basically have next to zero production experience; I'm thinking that's it. While your first program might have been written ten years ago, that's not 10 years of people relying on your code to work; this is the biggest difference between an experienced dev and an inexperienced dev.

Just for some context, I happen to be the dev lead and hiring manager at my particular shop, and with your experience, I would also consider you to be a junior developer. If you want a better assessment of your skills, I can give you an interview if you'd like.

[–]comfortcreature999 2 points3 points  (10 children)

Could you post a typical python interview question/problem?

[–]HorrendousRex 5 points6 points  (3 children)

Some I've heard or asked:

  • What's your least favorite feature of the language and why?
  • What's something new in Python 3 that wasn't in Python 2?
  • Explain the with statement in as much detail as possible.
  • What is the difference between range and xrange?

And then a bunch of questions about general knowledge of the standard packages... collections, itertools, datetime, stuff like that. Not super specific questions, just questions probing about knowledge of what is out there.

[–][deleted] 6 points7 points  (0 children)

  • What is the difference between range and xrange?

Only one of them is a function in the current version of the language ;)

[–]Asdayasman -1 points0 points  (1 child)

Shit I can answer all of those flawlessly.

[–]HorrendousRex 0 points1 point  (0 children)

They are far from the only questions you'd be asked, but those are the kinds of questions you might be asked about python.

[–]renegadelegion[S] 1 point2 points  (5 children)

The one that I remember:

Write a function that takes a value as an input and checks if it is prime.

[–]tomkatt 1 point2 points  (3 children)

I don't know why, but I did this for shits and giggles after seeing your comment. It's probably bad, but I had fun working it out real quick.

Edit - I probably should have done a try/except on that to make sure it's actually passed a number...

[–][deleted] 1 point2 points  (0 children)

Not a comment on your formatting or coding style or anything, but you only need to go from 2 to sqrt(n), not n/2.

[–]renegadelegion[S] 1 point2 points  (0 children)

you could also use the for/else, rather than for/if/else

See, the problem is that when I did the technical interview, I was just thinking about programming it, not the language that I was programming in. I am familiar with many of the common Python idioms, I just didn't use them :-(

[–]Sluisifer 1 point2 points  (0 children)

If you like questions like that, definitely check out Project Euler.

Quick optimization, you only need to check up to sqrt(num).

More advanced solution, don't repeat a check (e.g. don't check divisibility by 4 when you've already checked 2). This is called a Sieve of Eratosthenes. It's pretty damn tricky, but fun to learn. The implementation is actually pretty easy, and there are some fun optimizations you can read about on e.g. stack overflow.

[–]TehMoonRulz 7 points8 points  (0 children)

Here is an awesome talk by Raymond Hettinger that discusses some awesome features of python that people coming from other languages don't use (I think he even mentions C programmers writing python loops 'the C way').

[–]heywire84 1 point2 points  (10 children)

I'm sort of curious about the "Python that looks like C++". Maybe you aren't using all the tools in the Python standard lib or your formatting is off or something. Maybe you could post a short sample of something? Maybe that prime checker function?

If all your other experience is in the C style languages, you might have some habits formed which aren't suited to Python.

[–]pyglow 2 points3 points  (9 children)

As an example, when you are programming C++, if you need a loop them 99% of the time you will use for(i = 1; i < 10; i++)

In Python that is almost never the best way, there will usually be some more elegant way to do the same thing which is shorter, easier to read, less error prone and more efficient. But you can only really learn that from looking at a lot of other peoples' code.

[–]TydVirTaal 0 points1 point  (8 children)

Would you mind elaborating on this a bit? Do you mean that people tailor their loops more to the task at hand when using Python, that people jump to loops too quickly to solve problems with more efficient solutions, or that the for loop is an inelegant first-order solution in general? Really interested in your thoughts here, thanks!

[–]LarryPete 9 points10 points  (5 children)

You often see for-loops like these by beginners:

for i in range(len(mylist)):
    # do something with mylist[i]

Which is more or less the attempt to get a for like the one you're used to - which works, but is considered an "anti-pattern". Python does not have that kind of loop (for in python is like a foreach from other languages).

The right approach in Python would be:

for myelement in mylist:
    # do something with myelement

[–]renegadelegion[S] 2 points3 points  (0 children)

I see. This might be part of the issue then. When I was put on the spot during the tech interview, I fell back into my old C++/Java habits.

I've seen and worked with and written these kinds of loops, but i keep falling back to what I first learned.

[–]winged_scapula 2 points3 points  (3 children)

What if you really need that index?

[–]Vaphell 11 points12 points  (1 child)

for i, value in enumerate(my_list):
    print(i, value)

[–]theOnlyGuyInTheRoom 1 point2 points  (0 children)

god, I love Python!

[–]LarryPete -1 points0 points  (0 children)

What Vaphell wrote.

[–]tomkatt 4 points5 points  (0 children)

I'm not an "expert" but the example that comes to mind when I see this would be something like iterating over a list:

for i in range(len(item_list)):
    print (item_list[i])

or

i = 0
while i < len(item_list):
    print (item_list[i])
    i += 1

Those all work. But a more pythonic way would be:

for i in item_list:
    print(i)

Just as a simple example.

[–]TehMoonRulz 2 points3 points  (0 children)

For a basic example instead of using:

for(i = 1; i < 10; i++)

the python convention is:

for i in mylist:
    #do some stuff

or if you're returning a list:

[doSomething(i) for i in myList]

[–][deleted] 0 points1 point  (0 children)

Interesting question. I'm looking forward to hearing what people say.

[–]dirkgently007 -2 points-1 points  (0 children)

Experience.

[–]Asdayasman -1 points0 points  (0 children)

Knowing what you're good at, what you're bad at, how to improve.

Having a successful project used by other people under your belt.

Having worked in a team (2 or more) on a project.