34 Matching Annotations
  1. Sep 2023
    1. Is the len() function in the list example an acceptable pattern? It's written as a recursive function, which goes arbitrarily deep. Is this optimized and idiomatically correct? Or is this just for demonstration? In which case, is such a list much harder to do properly without enums?

    1. From the article, the meaning of &[][..] is not clear:

      // Example of empty slice &[]:

      let empty_array: [u32; 0] = [];

      assert_eq!(&empty_array, &[]);

      assert_eq!(&empty_array, &[][..]); // Same but more verbose

    1. new container type which is not generic

      not clear about the implications of this re: generics. Can a generic instantiation of a type implement Display()? What are the other limitations, and their solutions?

    1. Frozen data can't be modified until the immutable binding goes out of scope:

      Is there a significant use case for this, or is it just demonstrating a special case of the concept of shadowing?

    1. A possibly mutable variable with 'static lifetime. The static lifetime is inferred and does not have to be specified. Accessing or modifying a mutable static variable is unsafe.

      This is good to know, and also quirky/potentially overly complex.

  2. Jul 2023
  3. Jun 2023
  4. May 2023
    1. 5. If you could magically make one change to all keyboards in the world, what would it be? "Eliminate the need for a keyboard. It’s really a pretty archaic means as an interface. The very origin of the QWERTY layout is inefficiency. It was designed so that the operator could not out-run the typewriter and cross up the type levers. How about an entry system that reads the mind. Voice is nearly there, but it’s hard to have a quiet environment."
    1. We cannot use objects to calculate and perform analysis here. We must convert the type object to float64 (float64 is a number with a decimal in Python).

      That's because you didn't clean the data in this example. In the following code, astype() didn't "convert objects to floats." You called dropna(), which eliminated the "objects" because those rows also happened to have blank columns.

  5. Apr 2023
    1. Three in 10 Black adults and one in five Hispanic adults said they had personally witnessed someone being shot, according to the study. A little more than one in five (22%) of Hispanic adults said they had seen someone being shot.

      :-0

    2. More than one-third of Black adults said they had a family member who was killed by a gun, compared with 17% of White respondents and 18% of Hispanic adults who participated in the study.

      😥