I like programming and anime.

I manage the bot /u/mahoro@lemmy.ml

  • 16 Posts
  • 78 Comments
Joined 1 year ago
cake
Cake day: June 12th, 2023

help-circle




  • Just because you can get part of your education remotely or through self-learning didn’t mean “anything can be learned online”.

    And if you were hiring a math tutor for your kid, would you prefer a self-proclaimed expert from watching YouTube videos or would you want someone who got a degree from a credentialed university? And even if you don’t care, why are you surprised that others would be skeptical of the YouTube expert?

    Remote learning can be fine for some things, and self learning through informal channels are also fine, but it’s not a full on replacement for formal education in all cases.




  • The first way to use it is with any type annotation: you just use it for documentation.

    # int annotation
    def add_1_to_number(x: int) -> int:
        return x + 1
    
    # callable annotation
    def printer(x: int, func: Callable[[int], int]) -> None:
        results = func(x)
        print(f"Your results: {results}")
    

    These type annotations can help document and make editors parse your code to make suggestions/auto-complete work better.

    The second way to use it is by creating a callable. A callable is an abstract base class that requires you to implement the __call__ method. Your new callable can be called like any function.

    class Greeter(Callable):
    
        def __init__(self, greeting: str):
            self.greeting = greeting
    
        def __call__(self, name: str):
            print(f"{self.greeting}, {name}")
    
    
    say_hello = Greeter("Hello") # say_hello looks like a function
    say_hello("jim")  # Hello, jim
    








  • Fairly substantial price increase. I will admit a major draw of this small truck was the affordability. I think some trims are up as much as $2k. Wonder what kind of effect this will have on demand and the order banks.

    I mean, these trucks were on back order for a long time, which suggests that demand was way higher than supply. Yes, affordability was a major draw, but I’m not at all surprised at the price hikes here.

    I’m hoping other manufacturers see this and come out with their own compact trucks. There are rumors Toyota is working on one, for instance.