by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 22:28
    bid0uille opened #88
  • 22:09
    bid0uille opened #87
  • 21:50
    bid0uille opened #86
  • 21:16
    bid0uille opened #84
  • 21:11

    dabeaz on master

    fix typo in 02/07 line 14 'a~n~… Merge pull request #83 from bid… (compare)

  • 21:11
    dabeaz closed #83
  • 21:09
    bid0uille opened #83
  • 14:31

    dabeaz on master

    Merge pull request #1 from bid0… Fix missing word Word 'number'… Merge pull request #2 from bid0… and 1 more (compare)

  • 14:31
    dabeaz closed #82
  • 08:02
    bid0uille opened #82
  • Jul 02 22:51

    dabeaz on master

    Fix missing new line Insert a … Merge pull request #79 from bid… (compare)

  • Jul 02 22:51
    dabeaz closed #79
  • Jul 02 19:37
    moeller84 reopened #81
  • Jul 02 19:36
    moeller84 closed #81
  • Jul 02 19:34
    moeller84 opened #81
  • Jul 02 18:33
    altvec opened #80
  • Jul 02 14:18
    bid0uille opened #79
  • Jul 02 00:33

    dabeaz on master

    Update 03_Numbers.md The expec… Merge pull request #78 from cat… (compare)

  • Jul 02 00:33
    dabeaz closed #78
  • Jul 02 00:33

    dabeaz on master

    Fixed output problem (compare)

Mike C
@WaterBear1
Thanks @dabeaz for making this available. Just forked and cloned the repo - now I know what I'll be doing this weekend...
racorne
@racorne

Dear David, I appreciate your effort to create this course available for free.I've already created my own fork on github, but when I execute the first bash command:bash % git clone https://github.com/yourname/practical-python
I get: #No such file or directory"

Of course I've replaced "yourname"
My OS is Ubuntu

I hope you can help on this issue.
Regards from Chile,

Roberto

7 replies
tandelllc
@tandelllc
Great job David! Now got to hunker down and enjoy this. Thanks!
Denis Gubin
@denisgubin
Hi there!
Quincy Larson
@QuincyLarson

@dabeaz Thank you so much for making this book free and CC-SA 4.0. I will share this with the many people in the freeCodeCamp.org community who are learning Python.

https://twitter.com/ossia/status/1266452776948768771

Olav Vahtras
@vahtras
Thank you @dabeaz ! I will use this in my teaching .
David Beazley
@dabeaz
@QuincyLarson That's great!
I'd encourage everyone to be on the lookout for small typos and errors. A lot of the material was converted from Apple Keynote/PDF to the current form in an effort to make it more web-friendly and easier to remix into other things. Definitely will fix errors that I know about.
Jock2018
@Jock2018
Thank you @dabeaz ! I
Deva
@Vasudevatirupathinaidu
We will be always grateful to you and for your work @dabeaz !
michaelluang
@michaelluang_twitter
Thanks for your hard work! @dabeaz
Ananth
@ananthp_gitlab
I've used python in the past for some scripting and exploring audio/dsp. I believe this course will help me refresh my python skills, and also bridge gaps in my understanding of the language. I'm especially looking forward to section(s) on organizing code. Thanks for making this course open-access @dabeaz.
Yash Varshney
@Yash-Varshney
Thanks @dabeaz for this wonderful course. I've been working with python from last 2 years but still I've many things to learn from this course.
kundyyy
@kundyyy_gitlab
@dabeaz wonderful course, thank you
Ashish
@ashishrajput15
Tried it today. Its far better than watching a video or using it on some codeacademy like website.
sreenivas
@CgCnu_twitter
https://dabeaz-course.github.io/practical-python/Notes/01_Introduction/03_Numbers.html Can someone clarify how "Booleans" are type of numbers ? I thought they are of the type "bool" ?
Deva
@Vasudevatirupathinaidu
Hi Sreenivas! I am not exactly sure about that. But mentioning them as a special datatype or Boolean data type is more meaningful I guess. Maybe he considered that because they always evaluate down to an integer (1 or 0) while doing calculation like 2 + True. This expression evaluates down to 3 because int(True) is equal to 1.
And transistors work with the boolean concept. digit 1 for True and digit 0 for False. It's just a binary system. But I myself consider them as boolean datatypes or special datatypes.
Jaideep Jagyasi
@jaideepjagyasi
Just starting my this course..
lolPirate
@lolPirate
@CgCnu_twitter @Vasudevatirupathinaidu the bool class is basically a subclass of the int or integer class. You can check it out by typing help(bool) in your python shell. Since it is a subclass it inherits properties from the integer class. Hence you can treat them as integers.
Deva
@Vasudevatirupathinaidu
Thanks man!
David Beazley
@dabeaz
Bools weren't even part of Python until Python 2.3. As such, a lot of existing code used 0 and 1 to denote truth. This is the main reason for the weird mixing of Bool/Int types.
HERNAN PESANTEZ
@HERNANPESANTEZ1_twitter
Terry Jones
@terrycojones
Hello @dabeaz ! Very nice/good of you to put the course online.
Deva
@Vasudevatirupathinaidu
Thank you sir @dabeaz
David Beazley
@dabeaz
Appreciate the kind words here. I also appreciate the various bug reports for little typos and things. Will fix/incorporate quickly.
Deva
@Vasudevatirupathinaidu
Thank you so much, @dabeaz sir. You have been doing a great job!
Greg Frazier
@gnfrazier
Thank you for sharing this course. Is there a tip jar?
David Beazley
@dabeaz
Nah, no tip jar. If you like the course, just tell your friends about it.
Bernardo Augusto Garcia
@bgarcial
Hello everyone. I am just started to come across the course. Thanks @dabeaz for sharing it.
Aleksey Tsalolikhin
@atsaloli_gitlab
Hello! Thank you for sharing this course. I took your Python intro class at USENIX LISA years ago. :)
Aleksey Tsalolikhin
@atsaloli_gitlab
Bit-wise NOT operator ~ (in https://dabeaz-course.github.io/practical-python/Notes/01_Introduction/03_Numbers.html) caught me by surprise. It is not listed in the BITWISE topic in in the interactive help(). It is listed on https://docs.python.org/3/library/operator.html as "Bit-wise inversion". I thought it would just flip the bits, but ~1 gives back -2 rather than 0. I think I'm missing something.
Aleksey Tsalolikhin
@atsaloli_gitlab
I gather this has something to do with how integers are implemented in Python with regard to signed (positive/negative). (https://stackoverflow.com/questions/31151107/how-do-i-do-a-bitwise-not-operation-in-python)
David Beazley
@dabeaz
Bitwise operators behave the same as they do in C. However, Python integers also have infinite precision. So, the number "1" is the same 00000....00001 (imagine an infinite number of 0s in front). If you flip all of the bits, you get 11111....11110. Now you have an infinite number of 1s in front. Written as a negative number (assuming 2s complement representation), the resulting value is -2.
You see the same behavior in C programs. For example, this prints "1 -2"
#include <stdio.h>

int main() {
  printf("%i %i\n", 1, ~1);
}
Aleksey Tsalolikhin
@atsaloli_gitlab
Thank you for your kind reply, @dabeaz . How does putting more zeroes at the front of the integer make it more precise? The value doesn't change? For example, 2 is the same as 02?
Aleksey Tsalolikhin
@atsaloli_gitlab
I must be missing something. I've studied https://en.wikipedia.org/wiki/Method_of_complements and I see that you can subtract a number by adding its complement; and from https://www.electronics-tutorials.ws/binary/signed-binary-numbers.html I got that "basically, two’s complement is one’s complement + 1" -- but I don't understand how when doing the ~ operation on "1", the computer knows that 11110 is -2 and not -6 or -14?
David Beazley
@dabeaz
The short answer is it's just a bunch of bits. The number "1" is represented by a certain bit sequence (e.g., 0b00000001). When you compute ~1, all of the bits are flipped and you get a different bit sequence (e.g., 0b11111110). The representation of that bit sequence happens to correspond to the value -2. I'm not sure I'd read a whole lot into it. However, I will say that viewing the actual value of certain operations involving binary bits can be mind-boggling. I don't think I've ever had a situation where I thought of bits as being "signed" like that.
jinxingvenus
@jinxingvenus
print("first test message")
gokhalen
@gokhalen
I had a bit of trouble understanding what happens when one sets properties. Take the code in chapter 5.2 in which properties are set for the variable "shares". When properties are set, what seems to be happening is that a property object is being created at Stock.shares. This property object seems to manage what happens when we try to set or get the attribute shares. I think knowing that there is a property object helps understand what happens in chapter 7.3, where property objects are returned by the function typedproperty.
David Beazley
@dabeaz
For this course, the main takeaway from properties is that it's (somehow) possible to customize what happens on attribute access. For more low-level coverage, you'd want to go exploring Python's "descriptor" protocol. Section 7.3 is ever-so-slightly opening the door and peeking into a new universe of metaprogramming. But really, that's a topic for a different day and a different course.
gokhalen
@gokhalen
Thanks, David
gokhalen
@gokhalen
Just got to the end of the course. Thank you for the very nice course. Building an application step by step really helps to understand the material.
Aleksey Tsalolikhin
@atsaloli_gitlab
Thank you, @dabeaz , your reply is very helpful. I won't read a lot into it. I definitely felt boggled, so I'm glad I'm not the only one. Thanks again!! :)
bid0uille
@bid0uille
@dabeaz : Hi. Got a question about the last exercise of the 02.04 section. To invert a dictionary, you suggest to use list(zip(prices.values(),prices.keys())). Is there a good reason to prefer that rather than [(value, key) for key, value in prices.items()], please (or ugliest [item[::-1] for item in prices.items()])?
bid0uille
@bid0uille
Ah, I'm seeing now we're not suppose to know about comprehensions at this step…
David Beazley
@dabeaz
Yes, really the challenge of that "invert a dictionary" is to do it only using skills learned so far.
Personally, I'd probably use a list comprehension.
(if it were just me sitting there coding for myself)