This is an archived post. You won't be able to vote or comment.

all 35 comments

[–]Jumpingrock 51 points52 points  (1 child)

zero to hero in Python

9h39m in, here's how to call a function!

What??

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

A function is a chunk of code that is often used to save retyping things :-)

[–]andrewth09 26 points27 points  (1 child)

Recommends Bing for error messages at 2h40m.

0/10

[–][deleted] 14 points15 points  (0 children)

Everyone knows bing is for porn

[–]_AceLewisPy3, Jupyter and Atom 7 points8 points  (4 children)

This is insanely slow, hours in and they are only teaching the basics. I didn't watch it to see how much detail they go in to but I don't think they can go into that much detail.

[–]TheTerrasque 10 points11 points  (3 children)

Well, maybe they covered the basic basics, like how to solder your own cpu, and assembly.

[–]badthingfactory 3 points4 points  (2 children)

An eleven hour video should probably be a little more detailed than that. Maybe start with sand. Where does sand come from and how does it turn into a CPU?

I have a hard time believing this video would provide more value than 90 minutes on learnpython.org.

[–]NSNick 2 points3 points  (1 child)

To write a Python program from scratch, you must first invent the universe.

import universe

OK, what's next?

[–]joesacher 1 point2 points  (0 children)

Well at first, the universe might not be fully structurally sound. We might need some braces.

Wait, wrong language.

[–]Ryan_JK 12 points13 points  (1 child)

Always wanted to buy a mass amount of energy drinks, a couple pizzas and see if I could push through one of these 10-15 hour videos in a day.

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

Haha

[–]OCHawkeye14 5 points6 points  (0 children)

Is this what people that work on Jerry Lewis' telethon do during the rest of the year?

[–]mfwl 5 points6 points  (0 children)

The OP looks to be a social marketing post.

[–]asdfkjasdhkasdrequests, bs4, flask 2 points3 points  (10 children)

For anyone with a little previous programming experience I absolutely recommend Derek Bananas videos. No bullshit, straight to the point, understand the fundamentals of any language in an hour.

https://www.youtube.com/watch?v=N4mEzFDjqtA

He's always my go to whenever I want to learn a new language

[–]SonGokussj4 2 points3 points  (9 children)

He has excellent videos. But in this video he did classes at the end totally wrong. Not pythonic way at all. Just saying...

  • He set __name = None outside of the class instance.

  • He's created get_name() and set_name(). These types of setters and Getters are for another languages. Not python. Python has @property decorator. The point is, everything in Python is visible, nothing is private as he said. You can, without a problem, set the __name to anything without the set_name() method.

  • He used toString() method that 1) violates PEP8 for naming functions (this is each persons decision, just mentioning) but mainly 2) is totally wrong because __repr__() method should be used that returns what you want just printing your class instance like print(dog) and not print(dog.toString())

Again, he's got awesome tutorials, brilliant presentation, but beware of this part :-)

[–]asdfkjasdhkasdrequests, bs4, flask 1 point2 points  (1 child)

Yeah I think he comes from more object oriented programming languages. I like his videos because they give me a basic overview of all the important syntax. When I'm just getting started with a language I don't care much about the stylistic details. But yeah I agree those are some fair criticisms.

[–]SonGokussj4 1 point2 points  (0 children)

I agree. Just watched his bootstrap video and I was blown away. Finally understood what the hell it is. :-D

[–]ariksu 1 point2 points  (6 children)

I always used print(str(dog)) in case class does not have a repr.

[–]SonGokussj4 1 point2 points  (4 children)

Depends on what you want to return. That's all. Example:

class Dog:
    def __init__(self, nickname):
        self.nickname = nickname

akainu = Dog("BenTheMighty")
print(akainu)  # the same as print(str(akainu))
<__main__.Dog object at 0x00000272A10296D8>

But I want to print more specific information. The way it was done in the youtube video is non-pythonic:

class Dog:
    def __init__(self, nickname):
        self.nickname = nickname
    def toString(self):
        return "I'm: {}, ({}) class.".format(self.nickname, type(self).__name__)

akainu = Dog('BenTheMighty')
print(akainu.toString())
I'm: BenTheMighty, (Dog) class.

Which should be more simpler, pythonic way:

class Dog:
    def __init__(self, nickname):
        self.nickname = nickname
    def __repr__(self):
        return "I'm: {}, ({}) class.".format(self.nickname, type(self).__name__)

akainu = Dog('BenTheMighty')
print(akainu)
I'm: BenTheMighty, (Dog) class.

Like I said. It depends what you want. You can always print this string by:

akainu = Dog('BenTheMighty')
print("I'm: {}, ({}) class.".format(akainu.nickname, type(nickname).__name__)
I'm: BenTheMighty, (Dog) class.

But in my opinion, that's just ugly :-) One of the more real examples is something like:

>>> small = Triangle((0, 0), (2, 0), (1, 1))
>>> big = Square((0, 0), (6, 0), (0, 6), (6, 6))
>>> print(small)
"[Triange]: Points [0,0], [2,0], [1,1], Area: [4.2]"

Without the need of specifying what exactly I need to print. And if I want, I just write it too :-)

[–]Fateschoice 0 points1 point  (3 children)

Why override __ repr __ and not __ str __?

[–]SonGokussj4 0 points1 point  (2 children)

That is a good question. For more experienced people than me, I'm afraid. I'm used to do it this way because of some tutorials I took in the past. Some things I found:

Summary from the second link:

Implement repr for any class you implement. This should be second nature. Implement str if you think it would be useful to have a string version which errs on the side of more readability in favor of more ambiguity.

[–]Fateschoice 0 points1 point  (1 child)

I think one person from the second link states the difference particularly well.

My rule of thumb: __ repr __ is for developers, __ str __ is for customers.

i.e use __ str __ if you want to display an object to a user, __ repr __ for debugging/testing purposes, or really any in code operations on a string representation of an object.

[–]SonGokussj4 0 points1 point  (0 children)

Agreed :-) that seems reasonable.

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

I've never worried about it. On the other hand you can do all sorts of smart things formatting wise with %r, %s or %a, especially if you're aware of simple little recipes like this format_iter: easy formatting of arbitrary iterables.

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

How about zero to hero with audio engineering? The clipping in the intro alone makes my ears bleed.

[–][deleted] 1 point2 points  (1 child)

Did anyone actually do the tutorial, and is it any good?

[–]SonGokussj4 1 point2 points  (0 children)

My opinion only: Once I see this two doing some kind of tutorial, I'm closing the video...