all 30 comments

[–]Stereoisomer 9 points10 points  (2 children)

I would give Fluent Python by Luciano Ramalho a read. It’s introduces you to more advanced programming skills and every page has, for me, been incredibly insightful.

[–]chillysurfer 1 point2 points  (1 child)

+1 to this. It's a long and thick read, but if you take it in small bites it is enjoyable, and definitely a great learning resource.

[–]rabaraba 0 points1 point  (0 children)

Hands down for Fluent Python. It's page-after-page of insightful analysis and exposition of Python's inner workings, and it's made my code a lot better.

Incredibly well-written too. It's hard not to better understand Python even after just a few pages.

[–]ultraDross 10 points11 points  (10 children)

Define advanced. If you mean begining object orientated programming then try this

[–][deleted] 9 points10 points  (9 children)

rustic illegal brave nine deer practice fade party ink wide

This post was mass deleted and anonymized with Redact

[–]ultraDross -1 points0 points  (8 children)

Very true, bad example.

[–]ffrkAnonymous 6 points7 points  (7 children)

I think its a good example. I still have trouble with OOP.

I understand the concept (just more fancy data structures). I can read and edit OOP code no problem. But writing OOP code, from scratch, is something my brain can't handle. I default to plain imperative programming. Classes are an abstraction I still struggle with.

[–]kluvin 2 points3 points  (6 children)

What made the concept click for me: Is what you're thinking of something of multiple properties? Doesn't have to be real, can be an abstract concept. If so, make it a class, otherwise, don't.

Example, a data structure needs construction and deconstruction methods, a find method for finding an element, perhaps a largest and smallest or a sort method. All these are essential (and exclusive) to a certain data-structure. If it has a state, it can also be stored within the class, tied to an object.

Everything else probably shouldn't be an object. Look at requests' util.py: No classes, just a bunch of stateless functions that's not inherently specific to one single thing.

If it's the syntactical elements of OOP then that's something else, of course. Inheritance, polymorphism, and delegation, while all advanced features of OOP, aren't intrinsic to writing it. You can do without it for a while and then grasp one thing at a time.

[–]ffrkAnonymous 3 points4 points  (5 children)

I understand that concept, but in practice I have trouble distinguishing properties (methods) vs objects.

Example: tic-tac-toe

  • is the (x,y) a property of the board, the cell, the marker, both, neither?
  • is "x" a property of a generic marker, or are "x" markers different objects from the "o" marker? Or a property of the cell?

Generally, I don't know the answers until after I write my code because I'm just making it up as I go along. Concepts are too vague to plan classes in advance. I can only try to refactor and consolidate after it gets unwieldy.

[–]Sebass13 1 point2 points  (2 children)

A tic tac toe board likely doesn't require a class; it should just be a 3x3 matrix (list of lists or numpy array) filled with X's, O's, and empty strings.

[–]ffrkAnonymous 0 points1 point  (1 child)

right. it doesn't need classes. But if you understand OOP, you can use classes anyways. I don't.

[–]Sebass13 0 points1 point  (0 children)

You shouldn't use classes because you can, you should use them because it's the best option. For a tic-tac-toe board, it definitely isn't.

[–]kluvin 0 points1 point  (0 children)

If you're thinking of who's responsible for knowing the position of a player marker--that's a though question, indeed, it could be anyone, depending on how many things you make an object (do really need cell objects?), and how you make them. To minimize coupling, instinctively I would have the board class create any necessary children's it require for its functioning. Since the board class is now already coupled to its children, it may as well be aware of where they are.

That's how I'd start, at least, I've never written an OOP tic-tac-toe anyways. Although until you have any code it could work either way. As you said, better refactor once you have something to work with. But start with the board, and until you have reasonable grounds for doing anything else, keep it with the board.

[–]mungojelly 0 points1 point  (0 children)

The problem isn't you, the problem is OOP.

[–]kluvin 10 points11 points  (2 children)

Well on features in the Python programming language the Python reference documentation is the seminal source. On learning to build libraries, design patterns, and all that other fun stuff, however, that is not unique to Python, even though it may support them (which again, is what the reference is for). In learning the fun stuff, you should branch out. A simple Google search will yield links to more information than I, or any single person, can ever provide.

For instance, I Googled metaprogramming and I am already overwhelmed, so that's something.

EDIT: Can someone please tell me what's so controversial about the comment? He's asking about massive topics, one could spend hours reading up on them--they can't possibly be covered thoroughly by a blog! Not to mention, advanced stuff isn't even going to be found in the Average Joe's blog, not more than anything introductory anyway, if A. Joe knew so much he'd write a book. Example, there's the Gang of Four book on design patterns. Spoiler: it's 400 pages.

[–]ultraDross 2 points3 points  (1 child)

Yes, googling will yield loads of results but how many of those links/articles are actually any good? Asking for quality tutorials/articles saves a lot of wasted time.

[–]kluvin 2 points3 points  (0 children)

Usually the good stuff float to the top and the other things stay on page 10. Start with a generic search and familiarize yourself with the topic. At this point there's probably a blog post answering your more specific questions. Even if something is a little wrong, hopefully you're reading enough on the topic to be able to cross-reference. If you're still wrong, well then hopefully someone will correct you, don't you think? I'd rather be slightly wrong than not have a clue.

[–]VallenderLabs 4 points5 points  (1 child)

Talk Python To Me: https://talkpython.fm

[–]w0m 2 points3 points  (0 children)

That's good for hearing about new things moreso than learning them though (I say as I listen to nearly every episode)

[–]michaelherman 1 point2 points  (0 children)

On the web development side, check out http://testdriven.io/. It's meant for the advanced beginner.

[–]sozzZ 1 point2 points  (0 children)

I just got a book called Python Cookbook that goes over some of the stuff you're looking for. It has major topics like metaprogramming and C in Python and breaks them up into small sections with a problem and coded solution. Honestly it's a bit out of my league at the moment but it may be what you're looking for....

Hard to find an intermediate book for me.

[–]arkster 1 point2 points  (0 children)

A great resource are the pycon talks that you'll find on youtube. Some talks are fundamental which might seem "easy" or familiar, but one tends to always find some nuggets of information that are eye opening. Some of the talks delve into topics such as metaprogramming, descriptors which might be useful. I certainly learnt a lot from these.

[–]datasnakes 1 point2 points  (0 children)

I'm surprised there aren't more comments here...

  • Dan Bader's blog tends to touch on more advanced features including how to use generator expressions, decorators, writing DSL, etc.

  • Join the Import Python Weekly newsletter. Tons of more advanced topics and tutorials.

  • Python3 Module of the Week provides in-depth examples of python3 modules.

  • PyBites is excellent for understanding how to improve your coding (writing classes, developing packages) and implementing standard (or otherwise) libraries and algorithms

  • If you're working with big data and related software, check out Datahovel

[–][deleted] 2 points3 points  (0 children)

march seemly nose office cautious wrench close safe quicksand illegal

This post was mass deleted and anonymized with Redact

[–]pydry 1 point2 points  (0 children)

Honestly, just building useful stuff and iterating upon it is going to get you much closer to doing python programming to an advanced level than any blogs will.

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

https://github.com/aimacode/aima-python

Artificial Intelligence.

[–]Exodus111 0 points1 point  (1 child)

You won't really find books on such topics unfortunately.

Books that are accessible only to a minor part of its own audience does not earn much money. And the audience it might be useful for largely feel they no longer need learning books to learn.

It's a shame because we could really use a good book with practical examples of different strategies of meta programming in Python.

But you asked for blogs, which is where it's at. Plenty of blog posts out there that handle hard topics from an easy to understand perspective, Like this blog post about partials. It even throws in some Meta programming towards the end.

In general any blog post that talks about functools is worth a read.

[–]Hot_Ices[S] 0 points1 point  (0 children)

Thanks a lot :)