News for hackers. Stuff that matters.
Re:Ask HN: How many of you non-tech people wanted to learn t... by pythonscheme on Monday May 30, 2016 @10:23AM (#11801471)
I am having some problems with magic methods in Python. They are defined inside a class using built-in functions and are not directly callable. What are some helpful resources with this topic? Thanks.
Re:Ask HN: How many of you non-tech people wanted to learn t... by pramodliv1 on Monday May 30, 2016 @03:19PM (#11802634)
Here's my beginner-friendly article on magic methods: https://conceptcoaster.com/course/python-tutorial/magic-meth...

If you have any trouble understanding it, go to the homepage: https://conceptcoaster.com/course/python-tutorial/ and work your way to magic methods.

Re:Ask HN: How many of you non-tech people wanted to learn t... by ivank on Monday May 30, 2016 @01:57PM (#11802339)
http://www.rafekettler.com/magicmethods.html#appendix1

and you can call them directly:

  >>> (3).__neg__()
  -3
Re:Ask HN: How many of you non-tech people wanted to learn t... by _RPM on Monday May 30, 2016 @12:12PM (#11801942)
The Python docs are high quality.
Re:Ask HN: How many of you non-tech people wanted to learn t... by ams6110 on Monday May 30, 2016 @03:38PM (#11802723)
Word to the wise: avoid anything "magic" when writing code.
Re:Ask HN: How many of you non-tech people wanted to learn t... by thrownaway1984 on Monday May 30, 2016 @04:00PM (#11802840)
Word to the wise. Better to stay silent and for people to think you stupid than to open your mouth and have them know for sure.

Python magic methods are not "magic" but are a very standard part of the language and are well documented.

Re:Ask HN: How many of you non-tech people wanted to learn t... by ZanyProgrammer on Monday May 30, 2016 @05:25PM (#11803300)
And you wonder why some people never catch onto programming.