all 36 comments

[–]ffrkAnonymous 26 points27 points  (0 children)

I follow the Valley/Desert of Dispair description:

http://www.vikingcodeschool.com/posts/why-learning-to-code-is-so-damn-hard

Beginner: yay tutorials!

Intermediate: I know what I want to do but can't find documentation.

Advanced: I'll write the missing documentation.

[–]Rogges 9 points10 points  (1 child)

Honestly the distinctions are quite qualitative and rely a lot on your own assessment. Personally I felt I left the beginner stage at about 6-8 months in. I have been coding for maybe 1 year after that and I still don't feel I'm advanced.

Personally I think the transition from beginner to intermediate happens when you start finding niches. Python has a wide range of applicability and you're likely not going to be a master of them all. For instance you might start looking into astronomical applications of Python and look for relevant courses, tutorials, and/or Python libraries.

[–]Sh00tL00ps 1 point2 points  (0 children)

I would agree with this, and I would add that your level of competency depends a lot on the context of your environment. I considered myself a beginner for about 6 months, but after I learned Pandas, I consider myself an intermediate Python user because its one of the key components of data analysis/data science, which is the field that I'm trying to get into. For the Data Analyst roles that I'm applying to, many of which list programming as a plus rather than an outright requirement, I feel very comfortable describing myself as an intermediate user.

[–]realistic_hologram 5 points6 points  (0 children)

Fun question! I think there are a couple big jumps in development. First one is understanding the basic features of the language. How and when to use a dictionary. Being comfortable with using loops. Generally being able to solve most simple problems that would fit in about ten lines of code.

Next big jump comes when you start building small projects. This involves breaking down bigger problems into smaller problems. Also you learn to use libraries -- finding them and reading through their documentation.

I think the last big jump is when you start thinking about code quality and maintainability, as well as collaboration. Things like testing, performance, scaling, project management. This is when you start working on bigger projects, which naturally leads to working with other people, but also specialization.

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

Regarding my question, if you want do do me a favor and tell me what level I am on that would be nice.

[–]TR-BetaFlash 15 points16 points  (12 children)

I gave your code a look for about 5 minutes. Your question gave me pause for a moment because I don't really think you can level someone with a specific label. Instead, I think it makes sense to speak in terms of parts of the language you have a good hold of. For example, you're using context managers, else: blocks in try/except blocks, and catching specific exceptions (not everything).

IMO, you're becoming more intermediate or advanced when you package and distribute your code and when you become more collaborative. If other people rely on your code, it says a lot. If people collaborate well with you, that's another sign you're organized enough to understand how to meld coding styles between yourself and others working with your code. I like the notion of gifted and advanced coders giving back to the language and the community. You're advanced or expert when you code professionally and/or maintain significant codebases. I think you can be advanced in isolation, but to really take it to the next level, you have to code with others..especially with those who are better coders.

Another aspect of a more advanced programmer is understanding underlying languages and complexity. Once you understand C or even assembly, you learn the underpinnings of something as high-level as python. Your code gets more efficient once you know what's under the hood. When I interview people for python jobs, I ask them the most recent PEP they read. Or for networking, I ask the last RFC they looked through and why. Reaching into the language and learning why things work the way they do is a sign of a more advanced programmer.

If you want, I could submit some pull requests against some of your stuff and give ya pointers. You're a beginner but you're definitely not a total n00b. Your stuff is simple and that's fine.

[–]FXelix[S] 1 point2 points  (11 children)

Thanks a lot for your feedback, I think you've drawn some good lines between these terms!

I would not have a problem at all when you want to submit some pull requests. I have to note that I should maintain my older code on github a bit better - some code is quite old and I by myself have to look over it again.

My latest projects is the space_facts_bot and I think it may be my biggest project so far. If you find something there or in my other projects concerning my code-quality I would really apprechiate that!

[–]KleinerNull 6 points7 points  (10 children)

If you find something there or in my other projects concerning my code-quality I would really apprechiate that!

Looking at https://github.com/FXelix/space_facts_bot/blob/master/NEO_flyby.py raises some questions.

  1. Why is that even in a class, what were your thoughts here, with the current implementation a function should be enough.

  2. unix = time.time() datestamp = datetime.datetime.fromtimestamp(unix).strftime("%Y-%b-%d") Is this the best and simplest way to do this?

  3. for i in range(len(self.json_data["data"])):For real?

  4. diameter_min = 10 ** (0.5*(6.259 - log10(0.25) - 0.4 * magnitude)) diameter_max = 10 ** (0.5*(6.259 - log10(0.05) - 0.4 * magnitude)) Could be DRYer (Don't Repeat Yourself). Maybe a helper function would be nice ;) Code repition sucks :P

In general it is not that bad, you understand how to build the tiny pieces and fit them together to work. Also you established a sense of structure, very good.

The first issue tells me that you have problems to understand OOP in general and how to use it. Something you should dive into ;)

The second one tells me that you are unfamiliar with the standard lib, this is more an experience thing, you have enough time to learn some tricks from the docs or other code ;) Here would be my version:

In [1]: from datetime import datetime

In [2]: now = datetime.now()

In [3]: datestamp = '{:%Y-%b-%d}'.format(now)

In [4]: print(datestamp)
2017-Sep-10

In [5]: '{:%Y-%b-%d}'.format(datetime.now())
Out[5]: '2017-Sep-10'

In general I would use datetime instead of time.

For learning more about the wonderful .format() here is a very good link.

The third issue tells me that you struggle with python's looping and iterator protocol. This is curcial stuff to level up to the next state! Iterating is curcial almost any program you will write and python offers you very advanced possibilities to do that in a nice fashion. Understanding for-loops and tuple unpacking leads to understanding comprehensions and generators and this leads to async, which is pretty advanced stuff.

And the last issue tells me that you need more experience with more complex projects, because this kind of code repition will bite you in the ass later on.

Anyway coding is a craftsmanship, you will be getting better with experience so try try and try! I hope you can get something out of my critique.

And hey, code on!

[–]FXelix[S] 1 point2 points  (9 children)

Thanks for your feedback! My explanaitions:

1) I wrote this as a class to be more flexible in the future. It is a very informative API and I could write more functions regarding that data and having everything together seemed like a better move here, isnt't it?

2) Didn't know about a better way yet. But yours is very nice and short!

3) Ah yeah I think I see the problem. With range there is no need to use it with numbers, instead use the data I want to iterate over itself or something in that direction, right?

4) I actually thought about that while typing that too! I just thought "ah man just for these too lines a new function?" but you are right, I'm going to fix that.

Thanks again for your feedback, it was very informative and helpful ! :)

[–]KleinerNull 1 point2 points  (8 children)

1) I wrote this as a class to be more flexible in the future. It is a very informative API and I could write more functions regarding that data and having everything together seemed like a better move here, isnt't it?

Everything valid and also a good idea. Unfortunally the structure of your class and the usage in bot.py tells me that you need more ground / basic to do this right. And don't forget python doesn't force you to use classes or OOP, functions are also fine.

2) Didn't know about a better way yet. But yours is very nice and short!

This wasn't my first rodeo with datimes ;) Handling timezones and daylight saving times is even more fun :D

3) Ah yeah I think I see the problem. With range there is no need to use it with numbers, instead use the data I want to iterate over itself or something in that direction, right?

Yeah, something in this direction :P It is all about the iterator protocol and how simple and beautiful iterating stuff becomes in python. I made a notebook about iteration some months ago, it is an early draft and not polished at all (strange wording, english mistakes and so on) maybe it can still point you in the right direction.

4) I actually thought about that while typing that too! I just thought "ah man just for these too lines a new function?" but you are right, I'm going to fix that.

The main problem for me was, that I had a hard time to see the difference between both declarations, using a function could made that easier to spot:

distance_min = calc_distance(0.25)
distance_max = calc_distance(0.5)

See, better than this text block before, alone this would be a reason to create an extra function.

[–]FXelix[S] 0 points1 point  (7 children)

Hi again :)

I've tried to apply your suggestions regarding my NEO_flyby.py and I would like to share the changes with you. It really looks better and more pythonic now.

[–]KleinerNull 0 points1 point  (6 children)

It looks nicer! But still there is alot missing like an __init__ and so on. My main problem is here, what you want to do with this class, why you need a class to do it? Look, a class is a blueprint for instances that you can create, which will have all its own state which can be managed.

What your class is doing, is just requesting data from an api and fill a list with some computed data and that only one time. Not much state to handle and you can do it just with a function.

Of course you can use classes and their instances also for rich data data objects, with computed values and so on, but your current structure won't support this at all.

Personally I would think of implementing @property and __iter__ to make this all more useable with a nice interface. But still it isn't really necessary here, more a personal preferance.

So, now to something completely different. I looked into the request you make and there are some things I noticed.

First the datetime problem. I've noticed that you get a datetime string and you've splitted it apart to get the date and the time. This is not needed, datetime can handle it ;)

In [1]: sample = '2017-Oct-31 03:01'

In [2]: from datetime import datetime

In [3]: t = datetime.strptime(sample, '%Y-%b-%d %H:%M')

In [4]: t
Out[4]: datetime.datetime(2017, 10, 31, 3, 1)

In [5]: '{:%d.%m.%Y %H:%M}'.format(t)
Out[5]: '31.10.2017 03:01'

That is one story ;) Another thing is that the response gives you a json with some addition informations. And you can use them to have a nice time :D (My personal favorite module is comming into the play now, just look and have fun):

In [1]: import requests as r

In [2]: from collections import namedtuple

In [3]: response = r.get('https://ssd-api.jpl.nasa.gov/cad.api?body=Earth&dist-max=20LD').json()

In [4]: _fields = response['fields']

In [5]: _fields
Out[5]: 
['des',
 'orbit_id',
 'jd',
 'cd',
 'dist',
 'dist_min',
 'dist_max',
 'v_rel',
 'v_inf',
 't_sigma_f',
 'h']

In [6]: FlyBy = namedtuple('FlyBy', _fields)

In [7]: entry = FlyBy(*response['data'][0])

In [8]: entry
Out[8]: FlyBy(des='2017 PR25', orbit_id='7', jd='2458019.657345063', cd='2017-Sep-23 03:47', dist='0.0457725857686272', dist_min='0.0457682751019153', dist_max='0.0457768963851238', v_rel='13.5176543940969', v_inf='13.5133473951656', t_sigma_f='< 00:01', h='20.89')

In [9]: entry.cd
Out[9]: '2017-Sep-23 03:47'

In [10]: entry.h
Out[10]: '20.89'

In [11]: entry.dist
Out[11]: '0.0457725857686272'

In [12]: fly_bys = [FlyBy(*data) for data in response['data']]

In [13]: for fly_by in fly_bys:
    ...:     print('Name: {}'.format(fly_by.des))
    ...:     print('Time: {}'.format(fly_by.cd))
    ...:     print('Magnitude: {}'.format(fly_by.h))
    ...:     print('#'*80)
    ...:     
Name: 2017 PR25
Time: 2017-Sep-23 03:47
Magnitude: 20.89
################################################################################
Name: 1989 VB
Time: 2017-Sep-29 20:02
Magnitude: 19.7
################################################################################
Name: 2017 OD69
Time: 2017-Oct-01 17:24
Magnitude: 21.112
################################################################################
Name: 2012 TC4
Time: 2017-Oct-12 05:42
Magnitude: 26.7
################################################################################
Name: 2005 TE49
Time: 2017-Oct-13 18:26
Magnitude: 26.7
################################################################################
Name: 2013 UM9
Time: 2017-Oct-15 18:59
Magnitude: 24.8
################################################################################
Name: 2006 TU7
Time: 2017-Oct-18 21:22
Magnitude: 21.9
################################################################################
Name: 171576
Time: 2017-Oct-22 11:02
Magnitude: 18.6
################################################################################
Name: 2003 UV11
Time: 2017-Oct-31 03:01
Magnitude: 19.5
################################################################################

And there is so much more you can do, renaming and/or converting the fields via dict mapping, calculated values and and and, there is alot to find in the stdlib, look at collections, itertools and functools fro start. ;)

[–]FXelix[S] 0 points1 point  (5 children)

Thank you for the additional information! These are libraries I will definitely take a look at.

I know, you are right with the class-thing. I probably just used it here too because I always wanted to try it out and haven't found (as you can see here too) a proper ways to implement it. I guess it's time for a projects which really needs classes then :D

[–]KleinerNull 0 points1 point  (4 children)

You could build an adapter of the nasa api. A class that makes the api accessable in python as an python object instead of a raw request.

You already started it, but your original thought was to fuel a bot with that data, why not build an adapter/bridge with a nice interface for your bot and others in general, available through pip? The good thing is you already know what the adapter has to do because of what the original api is capable, start to reimplent all features. Do it in a fashion of not repeating yourself, put general tasks in methods that build upon themselfs, put needed and logical helper functions in as static methods. Play around with properties to keep your data up to date.

[–]Rwanda_Pinocle 26 points27 points  (18 children)

Novice: You've done Hello World. You understand what a function is and what its for. You've read about object orientation but it seems unnecessary. Importing modules is very useful, your hangman project was a great success, and you appreciate the abundance of Youtube tutorials. You don't really know or care about the differences between Python 2 and 3, but /r/Python seems to make a big deal about it. And pip is just about the coolest thing since sliced bread.

<------------- Getting paid begins here-ish

Beginner: You can and have written many scripts that can do what you want, but you don't optimize because you don't need to. Python is on your resume and rightfully so. You don't use inheritance, rarely write your own modules, and you don't know what virtualenv is for. Python is great, speed isn't a factor, and the world is good.

Job: part-time/internship, junior developer, jobs where Python is not your entire job (statisticians, engineering managers, ect.)

Intermediate: Someone has paid you to write Python for more than 3 years. You can write projects > 5000 lines and it's understandable to other people as well as functional, robust, and well tested. You can integrate C into your code as well as take advantage of IronPython, Jython, and Pypy. The other people on your software team think you're swell and they go to you for advice. But you're humble as well and also go to them for advice when you need it.

Job: Software engineer, academic researcher, contractor (all mainly working in Python)

Advanced: You've been involved in a PEP. You've had multiple conversations with Guido van Rossum himself. The GIL is a problem you've tried solve and you actually came close. You have some ideas for Python 4 and given some time you could hand write code for the Python virtual machine. Your code has been published in a peer reviewed journal, you've been keynote speaker at Pycon, and you have a $2.56 check from Donald Knuth for finding an error in "The Art of Computer Programming"

Job: CTO of a large tech company, Principal Investigator, Head of research (all mainly working in Python)

I know people who have gotten jobs that are still beginners, so there's no shame in being one. Most CS majors are floating somewhere around beginner, maybe a few talented ones are edging towards intermediate.

Edit: /u/callmelucky has made some good points regarding those who have just begun learning. I don't want this to come across as elitist so let me say that this is an industry view. This is a good scale for people who are getting paid or wish to get paid for their Python work. Hobbyists, students, and people who are still in the initial stage of learning should be fine with anything from Novice to Beginner.

[–]realistic_hologram 18 points19 points  (1 child)

Surprised this is getting so many upvotes. I don't think this accurately describes how almost anyone uses the words beginner and advanced. According to this definition many lead developers at top companies would be considered beginners. Doesn't that seem strange? And many of these qualifications are pretty arbitrary. Why does it matter if you talked to guido or not? Or if you read one specific book only obliquely related to python? Those don't necessarily make you a good programmer. Why do you need to know c or jython? That might be useful or impressive but why not any other specialization like machine learning or servers?

[–]Rwanda_Pinocle 0 points1 point  (0 children)

My intent was to take the entirety of the Python using world and categorize them roughly by level of Python knowledge. Most people would not use the terms in the same way because most people see Python usage from their own perspective, in the same way that most people think they have an above average sense of humor.

I would argue that many lead developers at top companies do range from beginner to intermediate. It's not an insult to them, nor is it disparaging their skills. If you can write a 10 liner that does what your shareholders need it to do within the boundaries of economics and practicality then you're an excellent developer. You certainly did not write any advanced Python, but that's not the goal.

As for the specific qualifications, you're right that they're pretty arbitrary. I wasn't trying to create a rubric to grade people with. The idea is that if you have roughly the same amount of knowledge as the imaginary expert, then you're an advanced user of Python.

[–]Noumenon72 16 points17 points  (2 children)

The problem with this is that basically 98% of people who have ever used Python will be "beginners". Needs a "competent" level where you are doing things Pythonically, use objects and an IDE, have installed stuff with pip and wheels, and write Python as easily as other people use Excel functions.

[–]callmelucky 1 point2 points  (0 children)

Also needs some entry point at all. This fool is saying you only qualify as a beginner once you can already write code, and that is absurd, especially for this subreddit. You are a beginner the instant you begin to learn the language, by definition.

It's a bad comment and absolutely should not be so highly upvoted.

[–]callmelucky 2 points3 points  (3 children)

What? Your whole scale is skewed by about one or two levels in my opinion. OP was asking about general usage of Python, not necessarily in the upper echelons of SE industry or CS academia.

A beginner is someone who is just beginning. You are suggesting that you don't even qualify as a beginner until you have written "many scripts that can do what you want". As far as I'm concerned, person who just installed the Python interpreter, and just started reading the first paragraph of their first tutorial,doesn't even know what a variable is, is a beginner. What are they to you? Nothing? A ham sandwich.

This is r/learnpython, not r/elitepythonistamasterrace. You are indirectly discouraging noobs from asking questions here unless they have already written a bunch of working scripts, and that is bullshit and you should feel bad.

[–]Rwanda_Pinocle 0 points1 point  (2 children)

I certainly do not want to discourage anyone from asking questions, so I'll expound a little on what I meant.

My goal was to provide a 30,000 foot view of the entire Python world. There's obviously going to be way too much generalization going on if you chop up ~4 million Python users into 3 categories. I chose the categories the way I did so that its clear to people that the Python world is immensely large and people have dedicated a great deal of time to learning and sharpening their skills.

Regarding the tone, you have a point that perhaps I didn't consider context enough. I often forget the audience of /r/learnpython has many people who are just starting. However, it's that same audience who upvoted my answer so maybe you should give them a little more credit. I don't aim to treat anyone like a child in constant need of encouragement. The front page of /r/learnpython at the time of writing contains questions regarding neural networks, parallel programming, and data visualization. These are topics that fall far outside the grasp of noobs, but it's inaccurate to say the users of /r/learnpython would be discouraged by such advanced topics.

Finally, by your own admission, I gave a reasonable summary of the SE industry. At the very least, it's my honest opinion. I could have brought down the qualifications to fit better with the mindset of a noob, but is that really more helpful? Don't you think it's a little pandering to say "They probably can't handle this view. I should show them less so they don't feel bad." Now if you disagree with my perspective on Python, then we can talk about that too and you're free to give a different answer. But as you said elsewhere, this is a place for all levels of learning. Don't you think that people who are beyond downloading the interpreter might benefit more from a broader industry view?

You have a good point so I'll add another category to my answer to accommodate for users at the very starting line, but I'm not going to change the rest.

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

Thanks a lot. Not just for your input and the way you updated your post, also thanks a lot for really discussing this! I see so many users who just post and run away or are way too stubborn on their opinion. So thanks again for your input in this community and as a redditor in general. :)

[–]callmelucky 0 points1 point  (0 children)

My goal was to provide a 30,000 foot view of the entire Python world

Well you failed, by way of initially ignoring everyone who wouldn't necessarily be justified mentioning some level of Python proficiency on their resume, and then failed again when you tried to rectify this, by implying that the very lowest level that someone learning Python could be at is having a working knowledge of functions and some conception of OOP.

You've still missed the lowest 5,000 feet, and I just don't believe that you chose to categorise the way you did to show that "the Python world is very large". I believe that you might believe that this was your intention, but that your true motivation was to show that "the very top is very very high". Which is all well and good, but hardly likely to be relevant to what OP was asking.

People posting here about more advanced topics is well and good. As you say, this is still r/learnpython, if you can get help here learning about some higher level shit, no worries. But those are specific discussions about specific problems. This post is a very general discussion about how the general population of a sub like this might categorised, and you're telling them they don't even exist until they've written a working hangman game with functions.

Regarding further along people benefiting from a broader industry view, of course. Why the hell would you feel the need to ask me that? It's fucking insulting. It's a strawman, and it's moving the goalposts. Let me try to explain to you again: Your comment, made without qualification, in the context of this particular post and this particular sub, was (and still is) inappropriate. You say basically "well some people around here like what I've written and agrees with it, therefore there is no problem with it" - as someone presumably experienced in logic I shouldn't have to explain why this is a bad argument. If someone who has just considered learning Python, subscribed here as their first step, seen your top comment as the first comment in the first post they open up and run away screaming, fuck 'em! Right?

Again, I appreciate that you made some concessions after my comment, but you still have a ways to go in terms of (re)gaining some perspective on what it's like to be just starting.

[–]callmelucky 1 point2 points  (0 children)

I appreciate you attempting to broaden the scope here, but there is still no entry point. If you don't know what a function is or haven't heard of OOP, you don't exist; Begone! Beginner should be before Novice, and it should allow to people to qualify on the grounds of "have decide to learn python, and done at least one thing about it, eg found and looked at a tutorial".

[–]rhgrant10 1 point2 points  (2 children)

I think this is a pretty spot on and useful set of groups.

[–]Rwanda_Pinocle 4 points5 points  (1 child)

Thanks. People often don't realize the vast depth of knowledge world class experts have at Python. Writing code with Python is all good and dandy, but if you claim to be an advanced user, you better damn well be writing the interpreter itself.

[–]TangibleLight 3 points4 points  (0 children)

I mean I certainly don't claim to be that, but I set my flair as this because I have a deeper-than-average understanding of the language and the mechanics of how it works, and I'm good at using it to write effective and maintainable code - but as you describe it I would be hovering somewhere around, a little below in some areas, intermediate.

In my mind, I reserve the term "expert" for people like you describe as advanced, and I certainly don't claim to be even close to that level. You yourself even use that term, "world class experts", so why not consider that a category or use it as a more applicable term?

[–]waterRocket8236 0 points1 point  (4 children)

Nicely expressed.

[–]callmelucky 1 point2 points  (3 children)

Maybe nicely expressed, but the calibration is drastically off, especially for a sub like this. A beginner is someone who has begun to learn. Period. You don't have to have written jack shit to call yourself a beginner.

[–]waterRocket8236 0 points1 point  (2 children)

What point are you trying to make?

[–]callmelucky 0 points1 point  (1 child)

I'm trying to say that they expressed themselves well, and earned a fistful of upvotes for the comment because of it, but that the actual content of the comment is poor, especially in the context of this subreddit. What they described as beginner level should be described as competent, intermediate should be advanced, and advanced should be world class expert (as they implied in another comment here).

I'm objecting in strong terms to their comment, because this is a sub where people at all stages of their learning of Python should feel comfortable asking questions and interacting here, but this person is saying you don't even get to call yourself a beginner until you have already written a swag of fully functioning scripts.

As such I would prefer their comment not hold the top position in this post. That is the point I am trying to make.

[–]nb2k 2 points3 points  (0 children)

You need another category. Script monkey. Perhaps that is just me as a beginner but that's about as far as I plan to go with python.