Alexander Hess - Pythonista
Alexander Hess - Pythonista
  • 74
  • 53 346
Popular examples of iterators
In this video, I show how we were using iterators already long before we formally introduced them in this course. For example, the range() built-in creates objects that behave like iterators (although they are actually not iterators). Other examples of iterators are the objects returned by the reversed(), zip(), and enumerate() built-ins. The commonality among them is that all of them model "rules in memory" that know how to generate a "next" element without generating it yet.
PYTHON BOOK
The lecture is based on the free book "Introduction to Python & Programming".
Get it on GitHub: github.com/webartifex/intro-to-python
SUBSCRIBE
If you like the way I teach and talk about programming and data science, subscribe to this channel.
The videos focus on coding courses and tutorials aimed at managers and students of business administration, enabling them to make better decisions with analyses done in code.
INSTRUCTOR
Alexander Hess, PhD Student
WHU - Otto Beisheim School of Management, Vallendar, Germany
CONTACT
GitHub: github.com/webartifex
LinkedIn: linkedin.com/in/webartifex
XING: xing.to/webartifex
Facebook: webartifex
Instagram: webartifex
Website: www.webartifex.biz
TH-cam: th-cam.com/users/webartifex
wa-vid-075
มุมมอง: 404

วีดีโอ

Comparing iterators with iterables
มุมมอง 3073 ปีที่แล้ว
In this video, I compare iterators (= "rules in memory") with iterables (= all objects over which we can loop). Iterators are always also iterables but the converse is not true. We see how the built-in iter() function creates an iterator out of an iterable argument. The iterator is then the "manager" of the iteration logic. PYTHON BOOK The lecture is based on the free book "Introduction to Pyth...
Creating "rules in memory" with generator expressions
มุมมอง 2143 ปีที่แล้ว
In this video, I introduce the generator data type. In spirit, it is related to the map and filter types created with the map() and filter() built-ins. We see how we should think of generators as flexible "rules in memory" that allow processing big amounts of (sequential) data on a one-by-one basis without needing a significant amount of memory. PYTHON BOOK The lecture is based on the free book...
Using map() and filter() with lambda expressions
มุมมอง 2103 ปีที่แล้ว
In this video, I review the example of the previous two videos, "A first look at the map-filter-reduce paradigm" and "Modeling 'rules in memory' with map() and filter()", and show how we can use the map() and filter() built-ins without having to define a functions. That is achieved with lambda expressions that upon evaluation create new function objects that have no name. Other than that, they ...
Modeling "rules in memory" with map() and filter()
มุมมอง 2033 ปีที่แล้ว
In this video, I review the example of the previous video "A first look at the map-filter-reduce paradigm", and show how we can use the map() and filter() built-ins to solve the same problem without using the memory in a significant way. map() and filter() produce objects of types map and filter that can be though of as "rules in memory" that know to generate a "next" element without generating...
A first look at the map-filter-reduce paradigm
มุมมอง 2233 ปีที่แล้ว
In this video, I introduce the map-filter-reduce paradigm. Conceptually speaking, it is simply a classification scheme for the individual processing steps involved in some "bigger" computational problem. In the video, we use memory inefficient temporary lists to solve an easy task. In the next video, we revisit the example and show how built-in data types can help us get to a memory efficient s...
Tuples as records of data
มุมมอง 2453 ปีที่แล้ว
In this video, I talk about how we can view tuples as records of data. A record is a collection of fields and we use tuples to glue together otherwise unrelated objects. We see how namedtuples can then be used to extend this idea and add semantics into a program. That is a first step towards object orientation. PYTHON BOOK The lecture is based on the free book "Introduction to Python & Programm...
Packing & unpacking
มุมมอง 2493 ปีที่แล้ว
In this video, I talk about a nice "application" of tuples (and iterables in general), namely packing and unpacking. These concepts enable us to easily flip the values of two variables or design a function such that it can take as many arguments as we want. PYTHON BOOK The lecture is based on the free book "Introduction to Python & Programming". Get it on GitHub: github.com/webartifex/intro-to-...
Tuples are like immutable lists
มุมมอง 2243 ปีที่แล้ว
In this video, I talk about the tuple data type. In short, tuples are like immutable lists. All "read-only" methods and operations of lists are also available for tuples. A good practice is to use tuples instead of lists as the default choice when working with sequential data and only revert to lists if mutation is needed. PYTHON BOOK The lecture is based on the free book "Introduction to Pytho...
Lists as arguments: Pure vs. modifier functions
มุมมอง 4743 ปีที่แล้ว
In this video, I explain the consequences of using list objects as arguments in function calls. In particular, we must understand that lists are mutable, and whenever we change a list that is passed in as an argument the "outside world" (= caller of the function) also sees these changes! This may be done on purpose but often times it is better to first make a copy of a list within the function'...
Popular list operations to know
มุมมอง 1733 ปีที่แล้ว
In this video, I explain how list objects behave when used with arithmetic or relational operators. In particular, we review the concept of concatenation that we already know from the discussion about string operations. Also, list comparison works according to the same logic as string comparison. Last, we briefly talk introduce the idea of unpacking that allows us to access the data in a list i...
Popular list methods to know
มุมมอง 2533 ปีที่แล้ว
In this video, I review popular list methods like the .append(), .extend(), .insert(), .pop(), and .remove() methods. Also, we compare the .sort() method with the built-in function sorted(). Most list methods have no return value indicating that the changes happen "in place", which is mostly the desired behavior for mutable data types. PYTHON BOOK The lecture is based on the free book "Introduc...
Shallow vs. deep copies
มุมมอง 2093 ปีที่แล้ว
In this video, I explain the difference between shallow and deep copies with the example of a nested list object. Shallow copies simply copy the references inside a container objects whereas deep copies also follow the references recursively and duplicate an entire data structure in memory. Shallow copies take a lot less memory but will lead to semantic errors in a program when the data inside ...
Lists are mutable sequences
มุมมอง 2553 ปีที่แล้ว
In this video, I talk about the basics of the list data type. We see how lists contain merely references to other objects and review the four properties every sequence has and conclude that lists are simply mutable sequences. PYTHON BOOK The lecture is based on the free book "Introduction to Python & Programming". Get it on GitHub: github.com/webartifex/intro-to-python SUBSCRIBE If you like the...
Sequences are sized and ordered containers that we can loop over
มุมมอง 2223 ปีที่แล้ว
In this video, I explain what the list and str data types have in common. In particular, they share four properties: 1) container, 2) sized, 3) iterable, and 4) reversible. All data types with these properties are also referred to as sequences. PYTHON BOOK The lecture is based on the free book "Introduction to Python & Programming". Get it on GitHub: github.com/webartifex/intro-to-python SUBSCR...
String interpolation with f-strings and the format() method
มุมมอง 2503 ปีที่แล้ว
String interpolation with f-strings and the format() method
Common string methods and operations
มุมมอง 2823 ปีที่แล้ว
Common string methods and operations
Strings are immutable sequences
มุมมอง 2753 ปีที่แล้ว
Strings are immutable sequences
Modeling textual data as strings
มุมมอง 2983 ปีที่แล้ว
Modeling textual data as strings
Classifying numbers with the numeric tower
มุมมอง 2383 ปีที่แล้ว
Classifying numbers with the numeric tower
Floating point numbers are inherently imprecise
มุมมอง 2763 ปีที่แล้ว
Floating point numbers are inherently imprecise
How (integer) numbers are represented in memory
มุมมอง 5203 ปีที่แล้ว
How (integer) numbers are represented in memory
Abstract vs. Concrete Data Types in Python
มุมมอง 8263 ปีที่แล้ว
Abstract vs. Concrete Data Types in Python
Using indefinite loops to write interactive games
มุมมอง 2843 ปีที่แล้ว
Using indefinite loops to write interactive games
Collatz' Conjecture: How many iterations do we need?
มุมมอง 6823 ปีที่แล้ว
Collatz' Conjecture: How many iterations do we need?
Validating input with the type checking & type casting strategies
มุมมอง 3153 ปีที่แล้ว
Validating input with the type checking & type casting strategies
Finding Fibonacci numbers in two ways: Recursion & Looping
มุมมอง 4273 ปีที่แล้ว
Finding Fibonacci numbers in two ways: Recursion & Looping
Finding the factorial of a number in two ways: Recursion & Looping
มุมมอง 4123 ปีที่แล้ว
Finding the factorial of a number in two ways: Recursion & Looping
Executing code repeatedly with a while loop
มุมมอง 4073 ปีที่แล้ว
Executing code repeatedly with a while loop
Executing code repeatedly with a recursion
มุมมอง 5593 ปีที่แล้ว
Executing code repeatedly with a recursion

ความคิดเห็น

  • @AameenaSanaM
    @AameenaSanaM 4 หลายเดือนก่อน

    well explained!!

    • @webartifex
      @webartifex 3 หลายเดือนก่อน

      Thanks!

  • @kisho2679
    @kisho2679 6 หลายเดือนก่อน

    How can titels be numbered automatically?

    • @webartifex
      @webartifex 4 หลายเดือนก่อน

      That happens automatically withing JupyterLab with an extension.

    • @kisho2679
      @kisho2679 4 หลายเดือนก่อน

      Which extension, like MS Word?

  • @user-Des3
    @user-Des3 7 หลายเดือนก่อน

    Thank you very much. This video helped me shape and format the course project.

    • @webartifex
      @webartifex 4 หลายเดือนก่อน

      Glad it helped!

  • @Lonkines
    @Lonkines 7 หลายเดือนก่อน

    Thank you for very informative video!

    • @webartifex
      @webartifex 4 หลายเดือนก่อน

      My pleasure!

  • @qqqniyouqian
    @qqqniyouqian ปีที่แล้ว

    great video!

    • @webartifex
      @webartifex 10 หลายเดือนก่อน

      Thanks :)

  • @RichardKueckens
    @RichardKueckens ปีที่แล้ว

    Thank you for this explanation! I found it especially useful when you used python tutor as I realized an iterator works like the "manager" of the iteration process.

    • @webartifex
      @webartifex ปีที่แล้ว

      That is actually a wonderful observation you made. I like the term "manager". It's not formal but explains the idea in a beginner friendly way. Thanks!

  • @nickparchmann6653
    @nickparchmann6653 ปีที่แล้ว

    Is there any particular reason why we used the random.random() function instead of random.choice()?

    • @webartifex
      @webartifex ปีที่แล้ว

      The `random.random()` function allows us to fine-tune the probabilities in a way more convenient way than the `random.choice()` function. Think of the expression `random.random() < p_heads` which is `True` exactly "p_heads %" of the time.

  • @mrdiamondhands468
    @mrdiamondhands468 ปีที่แล้ว

    The video really helped me to better understand the rules & mindset of Python and write first, small codes by myself :). Maybe you could show in the future, at the beginning of the video a kind of content overview, so we better understand why the individual chapters come in the order they were discussed. It was a bit hard for me to find the thread at the beginning, but the longer I watched the video, the easier it was to follow. Kind regards from Fabian, Bsc 2024

    • @webartifex
      @webartifex ปีที่แล้ว

      Hi. I think you unfortunately watched the old playlist on the Python contents in my book. Here is the newer videos with shorter videos and video titles on a per topic basis that make a lot more sense: th-cam.com/play/PL-2JV1G3J10kRUPgP7EwLhyeN5lOZW2kH.html

  • @RichardKueckens
    @RichardKueckens ปีที่แล้ว

    Hi Alex, therefore if I use the attribute b.is_float() on b I would receive the same error?

    • @webartifex
      @webartifex ปีที่แล้ว

      Hi Richard. There is no such method on any data types in Python, at least not the built-in ones. You are confusing them the ".is_float()" method a) with the ".is_integer()" method on the `float` object or b) you simply want to know if an object is a `float` which you can find out with the type(obj) function

  • @peng3825
    @peng3825 ปีที่แล้ว

    why I cannot delete one column with double D in Mac?

    • @webartifex
      @webartifex ปีที่แล้ว

      Because the pro's all use Linux and not Mac ;)

    • @webartifex
      @webartifex ปีที่แล้ว

      Just kidding. Double D should work in Mac as well. You probably forgot to "leave" the cell with the "Escape" key first. Let me know if that works.

    • @peng3825
      @peng3825 ปีที่แล้ว

      I have solved this following your instructions. Thanks.@@webartifex

  • @sayantanbhowmik4196
    @sayantanbhowmik4196 ปีที่แล้ว

    Life saver man. Was searching for this from so long

  • @daniellchukwu
    @daniellchukwu ปีที่แล้ว

    Bro u are goated 👑👑👑

  • @GopiD18
    @GopiD18 ปีที่แล้ว

    Just to be sure: attributes like .sort() can not be applied to int, right?

    • @webartifex
      @webartifex ปีที่แล้ว

      Nope. ".sort()" belongs to other data types, e.g., the list data type

  • @bennetg2039
    @bennetg2039 ปีที่แล้ว

    i really appreaciate the time stemps here, would love to see them more in the other videos.

  • @SeverinoCatule
    @SeverinoCatule ปีที่แล้ว

    Very nice video mate, a lot of great questions about how to develop and justify some choices in data science.

    • @webartifex
      @webartifex ปีที่แล้ว

      Glad you liked it!

  • @siddheshd9
    @siddheshd9 2 ปีที่แล้ว

    make a detailed video about environment and how to add them to ide or code editors, there are no proper video about these on yt

    • @webartifex
      @webartifex ปีที่แล้ว

      i will do that for my next recording of my lectures :)

  • @gecesoftware3555
    @gecesoftware3555 2 ปีที่แล้ว

    very good

  • @sophiehaussmann1747
    @sophiehaussmann1747 2 ปีที่แล้ว

    Thank you very much for the explanation! How exactly are tuples and lists different other than their mutability? I don't think I quite got that.

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      That part you mention is the MAIN difference. In addition, because of that difference, tuples do not have methods that mutate a list.

  • @elenagonzalosaul5766
    @elenagonzalosaul5766 2 ปีที่แล้ว

    Many thanks for the videos! They were very helpful in understanding the content of the lectures in more detail.

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      You are welcome!

  • @enzokirschstein1330
    @enzokirschstein1330 2 ปีที่แล้ว

    Thanks, well explained!

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      You're welcome!

  • @henriettestreminski286
    @henriettestreminski286 2 ปีที่แล้ว

    By generating the list in lists, does it create a completely new list? If I change something in the first list will it automatically update?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Lists within lists may lead to "weird" situation from a beginner's point of view, especially if the outer list is copied somehow (or sliced). That happens because then we have more than one outer list referring to the same inner lists, which are not copied.

  • @henriettestreminski286
    @henriettestreminski286 2 ปีที่แล้ว

    Thank you for the great video! Is it possible to receive a run-time error? Especially by making more complex loops or recursions?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Yes, practically, runtime errors can occurs. Python by default can only store up to 3000 concurrent function calls in memory. That number can be changed but will always be some finite limit. Beyond that, we will see an error message

  • @larspeterhulseweh5185
    @larspeterhulseweh5185 2 ปีที่แล้ว

    In your corresponding book on Github you have a review question that asks whether "a substring is a string that subsumes another string". I am aware of the concept of substrings. It's a short string within a larger string object (e.g. we could obtain it via list comprehension). Somehow I don't fully understand the meaning/ logic of the word "subsumes" in this context. Is the question therefore true or false? Many thanks in advance!

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      The word "subsumes" here means "contains" => Therefore, the opposite is true: A substring IS subsumED by another string

  • @paulpaul970
    @paulpaul970 2 ปีที่แล้ว

    After analyzing the videos and building Your demonstrated code, I am understanding why PEP 8 is used by so many Python users. Thanks a lot!

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      And PEP8 is only considered the bare minimum style guide. In practice, people use even more styling rules

  • @paulpaul970
    @paulpaul970 2 ปีที่แล้ว

    By unpacking the list, do further changes influence the new list?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      What do you mean with further changes?

  • @paulpaul970
    @paulpaul970 2 ปีที่แล้ว

    Is it possible to set a "dynamic" f-string including an input to get a "dynamic" return?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      From how I interpret your understanding of "dynamic", that is exactly what f-strings are for: They are a template containing a "dynamic" part

  • @paulpaul970
    @paulpaul970 2 ปีที่แล้ว

    Is it possible to take a view on the whole library of the imported "math"?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Kind of: "dir(math)" shows all the functions and constants while "help(math)" shows even more descriptions

  • @paulpaul970
    @paulpaul970 2 ปีที่แล้ว

    For solving this kind of questions where Recursion and Looping is giving the same result, which way is the more efficient one? Thanks! Paweł L.

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      In Python, if you can find a looping solution, it will be more memory efficient because Python then does not need to manage all the ongoing function calls

  • @paulpaul970
    @paulpaul970 2 ปีที่แล้ว

    Hey! I was trying to handle this example. Unfortunately the "except" is showing an invalid syntax. Do You have an idea why this is not working? Thank You! Paweł L.

  • @paulpaul970
    @paulpaul970 2 ปีที่แล้ว

    Could You please explain which advantage is made by making the lambda function in comparison to the typical function. Thank You! Pawel L.

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      They are useful in places where one needs to provide a function however there is no need to call that more than once. (Normal) functions with names are mainly there to be re-used!

  • @larspeterhulseweh5185
    @larspeterhulseweh5185 2 ปีที่แล้ว

    In addition to your videos I also had a look into your corresponding book on Github. In Chapter 2 under the review questions there is a true/false question asking "A mere function call is just an expression". In Chapter 7 (Sequential Data) you talk about so called modifier and pure functions. Modifier functions change the input variables (e.g. lists) and pure functions don't. To my understanding modifier functions have a permanent influence on the memory (as they change the object directly) which would classify them as statements. The opposite should be true for pure functions. Therefore, my question is whether we can classify function calls generally into expressions and statements? Many thanks for your help in advance!

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Great attention to detail you have. Generally, a mere function call is only an expression and should not have a side effect. However, as you noticed, we can create "modifier" functions that kind of have a side effect. However, such "modifier" functions should not be created in the first place (i.e., a best practice). Instead, one should create methods that modify objects. To fully understand that, see Chapter 11 in my book. But really, great attention to detail.

  • @annas7761
    @annas7761 2 ปีที่แล้ว

    But what exactly makes the iterative version so efficient?

    • @hendrikgrote3273
      @hendrikgrote3273 2 ปีที่แล้ว

      th eiterative approach is much more efficient because it only looks at the two predecessor numbers and does not need to store the other numbers in memory. Therefore, it needs less computing power and memory. The recursive approach looks at the whole thing and therefore needs exponential computing power which is a lot more inefficient and the reason why this approach only works with the smaller numbers. Hope this helps. Please correct me if I am wrong here @Alexander Hess - Pythonista

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Kind of. The iterative version does all the individual computational steps only once whereas the recursive version re-computes the same individual steps over and over again.

  • @kathrinrussbach3452
    @kathrinrussbach3452 2 ปีที่แล้ว

    Very good explanation of packing and unpacking! Especially the comparison to the zip() function and the use-case of swapping was beneficial to get a good understanding of when these principles can be helpful!

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Glad you enjoyed it!

  • @xirulyu5420
    @xirulyu5420 2 ปีที่แล้ว

    Thanks a lot Alex! The videos explained the contents in detail, and gives even more examples beside the lectures!

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Glad it was helpful!

  • @franziskanix7620
    @franziskanix7620 2 ปีที่แล้ว

    Great explanation on iterators and iterables! Especially the description on the "for loop behind the scenes" helped me a lot to get a better understanding.

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Glad it was helpful! At first sight, iterators seem a bit "advanced" but they are really everywhere in Python and are very powerful in the context of big data.

  • @hannabartels2577
    @hannabartels2577 2 ปีที่แล้ว

    Do I understand it correctly that all expressions are also statements?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Yes, but the reverse is not true. Expressions are all code fragments that are evaluated into objects (i.e., "results") by the Python interpreter. The concept of statements contains the concept of expressions in addition to statements that do NOT evaluate into objects. Such statements have a (permanent) side effect in the computer's memory though (e.g., the assignment statement creates a variable name).

    • @hendrikgrote3273
      @hendrikgrote3273 2 ปีที่แล้ว

      @@webartifex had exactly the same question, thanks for clarifying

  • @augustdeutz7905
    @augustdeutz7905 2 ปีที่แล้ว

    I really appreciated the time stamps in the previous video! Although they might not necessarily be needed in every video, I think it would be helpful especially for the sections where PythonTutor is being used

  • @florianrautenberg2815
    @florianrautenberg2815 2 ปีที่แล้ว

    You said, that we can classify concrete data types into abstract data types. Are abstract data types, by definition, always a "subset" of concrete data types with specific behavior (similar to the concepts of expressions and statements)?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Not really. In your picture, it is almost the opposite. The concrete ones are "subsets" of the abstract ones. Yet, the term "subset" is wrong here. For simplicity, see the abstract types as simply "group names", and the concrete ones are then put into various groups depending on their behavior.

  • @augustdeutz7905
    @augustdeutz7905 2 ปีที่แล้ว

    Great explanation, maybe you can further explain how the hexadecimal codes come together, f.e. What 26 or 120 would look like, as this only shows quite „simple“ examples

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Good idea. The next version of the videos will do that then.

  • @philippnippel7217
    @philippnippel7217 2 ปีที่แล้ว

    The videos really helped to better understand Python next to the lectures. Thank you for your effort!

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      You're very welcome!

  • @xeniafiona2109
    @xeniafiona2109 2 ปีที่แล้ว

    Is the binary number always the combination where you need the least 1s?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      No. Or I misunderstand your question. Once there will be only more 0s to the left, the notation usually cuts them off, just like leading 0s in the decimal system.

  • @linushansen6163
    @linushansen6163 2 ปีที่แล้ว

    It would be great if it could be briefly explained what effect it has on the outcome when print () is not indented, e.g. in the example: for number in numbers: result = number + 3 print (result) Other than that everything is explained very well in the video!

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      That is a good point. An absolute beginner may not understand the difference for indenting and not indenting. I'll take that into account for the next version :)

  • @johannschaper1
    @johannschaper1 2 ปีที่แล้ว

    Instead of using the ‘elif’ statement, could two ‘if’ statements also be chained into one big one through an ‘and’ or is that just not done for readability purposes?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      This really depends on the exact logic one wants to model. The point here is that the "elif"s are only checked if the preceeding "if" does not apply.

  • @xeniafiona2109
    @xeniafiona2109 2 ปีที่แล้ว

    why is it possible to have two if statements and not elif in the second one? (min 22:50)

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Because we are checking for conditions that are INDEPENDENT of each other, in a conceptually way. Also, note the "early exit pattern" at work in the example. So, I leave out a lot of "else"s and "return" from the function "early"

  • @xirulyu5420
    @xirulyu5420 2 ปีที่แล้ว

    It was really clear to compare the difference between recursion and while looping with pythontutor!

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      To summarize: In terms of computational steps, there should not be much of a difference. In terms of memory usage: recursion needs some memory to keep all the functions running before the recursion returns. So, in practice, the looping approach is often regarded as a little better.

  • @jonasdehne32
    @jonasdehne32 2 ปีที่แล้ว

    Thanks for the video :) I have a few questions haha. Will the !pip install command use your OS to create a new folder inside your python installation? And if so how does it know where to install it to? And how does the import statement know where to load the module from into memory? (i.e. when the current working directory is different from the file location) I assume it has to be some sort of relative mechanism as I as a user can individually determine where to initially install the anaconda distribution/ original python distribution.

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      There is no way to answer this question briefly :) For detailed info, search for "Python virtual environments" on the internet, or the "Python import system" (there is actually a nice but technical talk on a PyCon TH-cam channel on that). What you should know, in brief: 1) Besides the "system" Python (on Linux or Mac) which holds all packages available everywhere, there may exist 2) "copies" in so-called virtual enviroment, which are typically used on a per-project basis. 3) !pip in JupyterLab installs into whatever Python folder that is currently running JuypterLab. I should do a talk on this at some point because it's a topic of much confusion. Regarding the imports, they are indeed relative (or absolute) depending on how you import.

  • @philippnippel7217
    @philippnippel7217 2 ปีที่แล้ว

    Very good and clear presentation of how this works in memory!

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      The practitioner may wonder why he should learn such things. But the binary system is at the heart of a lot of CS theory and I think is quite an interesting thing to know as a person living in the 21st century :)

  • @johannschaper1
    @johannschaper1 2 ปีที่แล้ว

    One question regarding the memory: you mentioned, that if our computer runs out of memory, it would crash - Would that mean the program just closing itself without saving? And how much code “fits” in a regular computer’s memory before it is fully occupied?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      What a program does when running out of memory depends a bit on the programming language. Typically one would observe a computer freezing, or at least the program in question becoming unresponsive. Yet, in Python there is a fail safe system built in that simply quits the program with a MemoryError message instead of the computer freezing. In both cases, the program most likely will not save anything permanently onto a hard disk and whatever data/state is in the (working) memory will then be lost.

  • @hannabartels2577
    @hannabartels2577 2 ปีที่แล้ว

    Does the TypeError fall under runtime errors?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      Absolutely, it is an error occuring during runtime. Yet, experienced Python dev's would tell you that there are actually ways to discover TypeError's WITHOUT running the code. But that is beyond this intro video.

  • @hannabartels2577
    @hannabartels2577 2 ปีที่แล้ว

    When you talked about the limited size of the memory and that flowing objects usually have the same number of digits when they are infinite, you explained that there are usually 13 to 14 digits after the period dot. The example in the video shows 15 digits, and in the "Volume of a Sphere" exercises, our results never showed more than 10 digits. How come?

    • @webartifex
      @webartifex 2 ปีที่แล้ว

      The answer to that needs some more theory that I think goes too much into detail. The correct answer is that the number of digits modeled in memory depends on the magnitude of the number. Numbers closer to 0 in abs. terms have more digits. Yet, it's a good practice to pretend there are only up to 14 digits as that is the lower bound that works for all floating-point numbers. If you are really interested in this, check the the wiki page on the floating-point standard :)