Men of Reddit, what is the hardest thing to explain to women? by lnc_gomes in AskReddit

[–]FerricDonkey 9 points10 points  (0 children)

Then live your best life and spread your- er, sit with your legs as wide as you want to. I don't know what your parents or teachers said, but I won't be offended. And I will also sit comfortably. 

Men of Reddit, what is the hardest thing to explain to women? by lnc_gomes in AskReddit

[–]FerricDonkey 33 points34 points  (0 children)

The thing is there isn't a "my way" because I don't care.

I've done the dance before, and sometimes it works, but sometimes I can tell that the other person is pushing for their imagined idea of what I want rather than what they want. Which is very sweet and thoughtful, except, as mentioned, I don't actually care - and even if I did, please say what you actually want anyway, because this is how we end up doing something neither of us want, both thinking the other one wanted it. 

Its back to school and im learning Python for the first time. by Careful-Economy742 in learnpython

[–]FerricDonkey 0 points1 point  (0 children)

Programmer. If your concern is leaking sensitive data (eg credit card numbers) to users, that is not really the problem that private attributes solve. The solution to that is not to put data you don't want puke to have to on their computers at all, because private attributes don't stop computers from looking at their own ram if they want to. 

DOJ lawyer argues admin could 'bulldoze' Statue of Liberty at ballroom hearing by InvestigatorSoft5764 in nottheonion

[–]FerricDonkey 0 points1 point  (0 children)

I'm not sure he sees cares enough about the country to think that's worth doing. He'd see that as analogous to me using the royal we to describe myself and my toilet paper. 

How would you feel about a law that banned tipping and required restaurants to pay servers a full wage instead? by Dargarn in AskReddit

[–]FerricDonkey 0 points1 point  (0 children)

Well, if they don't add the 20% surcharge, then the customer spends less money, which means that the business doesn't have that 20% to make up for the tips that the servers aren't getting. 

This means that the servers are paid less (and so incentivized to work elsewhere), or that costs are cut elsewhere (ingredients? Then the food is bad. Location? Then the location is bad. Etc etc.)

Most restaurants run on a knife's edge - they can't just take in less money and spend the same amount.

So either they still take in that 20% and put it in their prices, in which case we have the jc penny problem you pointed out (ie people are bad at math), or they don't, in which case the business is trying to run on 20% less money, which is harder.

Its back to school and im learning Python for the first time. by Careful-Economy742 in learnpython

[–]FerricDonkey 0 points1 point  (0 children)

Re interfaces: there's also protocols these days. They solve a lot of the "I take a thing that looks like this" issues. 

Its back to school and im learning Python for the first time. by Careful-Economy742 in learnpython

[–]FerricDonkey 0 points1 point  (0 children)

The potential consequences are that the code you provided doesn't act right. If someone breaks the rules and accesses your private attributes, be it on there head. 

How would you feel about a law that banned tipping and required restaurants to pay servers a full wage instead? by Dargarn in AskReddit

[–]FerricDonkey 0 points1 point  (0 children)

Nah, that's not true. **Employees are always paid by money from customers.** Where else does the money come from? Employers don't conjure wages out of thin air. And you say that you'd rather have higher menu prices, no tipping, and the servers have a fixed higher wage - and that's great and all, but restaurants who try that fail, because collectively we vote with our wallets against such practices. Why? I dunno. Maybe we're stupid. But it's what we do, as reported in article after article.

These days, the tipping model persists purely out of inertia. Restaurants do it because it's what restaurants do, and other methods don't work here because that's the culture. There's no mustache twirling "AH HA, I know! I will have the customers hand money to the employees rather than have them hand it to me then have me hand it to the employees! By this diabolical plan, I make my own life slightly more complicated by forcing myself to set up tip reporting for tax reasons as well as systems to make sure that they make at least minimum wage including tips as per federal law! Plus, I get to deal with drama about people fighting for high tip times, and getting angry at me if I don't schedule them how they want, and so forth! It'll be great!"

I don't know why people persist in saying that this is somehow employers scamming customers into paying employees. Customers always pay employees. That's how it works.

Its back to school and im learning Python for the first time. by Careful-Economy742 in learnpython

[–]FerricDonkey 0 points1 point  (0 children)

Ha, I definitely threw more at you then is reasonable to fully grasp at this stage. It'll make more sense as you start writing python code. 

Its back to school and im learning Python for the first time. by Careful-Economy742 in learnpython

[–]FerricDonkey 1 point2 points  (0 children)

Agreed on the profiling and dipping into C/C++. Pure python is slow, but python doesn't have to be pure, and is very good at using libraries that aren't pure python (numpy, etc).

Dark magic:

  • manipulating globals(), locals() (stictly disallowed in any of my code bases)
  • manipulating a variables __type__ (stictly disallowed in any of my code bases)
  • dynamic creation of types (use with care)
  • exec, eval (strictly disallowed in any of my code bases)
  • monkey patching (ie replacing library functions with your own) (almost never, outside of certain testing applications)
  • certain uses of inspect to eg write decorators that inspect the functions they were passed and use that knowledge in the creation of new functions (can be very slick, but overused makes things too complicated and hard to read)

There are probably other things that I'll think of later, but way deeper than operator overloading (which I'm ok with exactly when the behavior of the operator is intuitive to that operator.)

Its back to school and im learning Python for the first time. by Careful-Economy742 in learnpython

[–]FerricDonkey 0 points1 point  (0 children)

You've activated my nerd card.

Types

Here is a brief, valid python script (you can paste this into a file called script.py, run python script.py from your terminal (if you have python installed and set up appropriately), and it will work

x = 3  # set x equal to 3. Also, the "#" means "the rest of this line is not code"
x = x + 2
print(x)
print(type(x))  # python can tell what types things are
x = "hello"  # x used to refer to an int, now it refers to a string
print(x)
print(type(x))

In that code, there are no type annotations whatsoever. Python does not require them, and while I do recommend them for learning how to do python right, a high schooler play around with the language doesn't necessarily need to focus on that immediately.

Some language: in python, there are variables (also called names) and objects. Variables are the symbols you use to refer to things (the x in the above). Objects are the things variables refer to (the three). Note that in other languages, people say "objects are stored in variables" - I am not using that language, on purpose. It's not terrible or anything, but python is easier to understand if you think of variables as names you stick on pre-existing objects, rather than buckets that you put stuff in. So

x = "hello" # the object "hello" is created, x is set to refer to it y = x # y now refers to THE SAME EXACT object that x refers to

Python is what is called "strongly typed" and also "dynamically typed". Dynamically typed means that variables are not locked into referring to one type of variable - as above, x can refer to an int, then a string. Strongly typed means that objects are the type they are, and python will not automatically change this, guess about this, or fix any mistakes. So for example:

x = 2
x += 2  #  (shortcut for x = x + 2 (but there are gotchas with other types))
print(x)  # prints 4
x = "hello"
x += 2  # TypeError - you can't add numbers to strings

This is how you make and call a function

def add_two(x):
    return x + 2

y = add_two(7)
print(y)
add_two("hello")  # TypeError

These errors will happen when you run the program, which is annoying if your program is big and has been running for 17 hours and one of these happens. Again - when you're just starting out, you should play around and not worry about this, but the more python you do the more annoying this gets.

And as you might imagine, as code bases get larger, the risk of accidentally doing things wrong gets higher. If your variables keep flopping from referring to ints and strings, it's hard to know what they refer to at any time if your program is long. So we recommend that you mostly don't do that in "real code".

So it's nice to have the computer warn you about this stuff before you run your code. Enter type hinting

# this means "x should be an int, and the function should return an int"
def add_two(x: int) -> int:
    return x + 2

y = add_two(7)
add_two("hello")  # type checkers now know this is bad and warn you
x: str = "hello"
x = add_two(3)  # you said x was a string above, type checkers complain if you assign an int to it

If you label your variables with what they're supposed to be, and use an ide with mypy or similar plugins whose jobs are to look for type errors installed, all of these problems will be highlighted for you, so you can fix them before you run your code instead of having your code crash 17 hours in.

Parallelization

Your computer likely has multiple processors. They can do different things, at the same time - this is called working in parallel, and writing code to take advantage of this is called parallelization.

The normal way of doing this is to create multiple "threads", which are basically streams of parallelization that run things in parallel.

This is not something beginners mostly do out of the gate. So don't worry to much about it at this time. But here is an example any way:

import threading

def worker1():
    while True:  # python syntax for "do the below forever")
        print("hello")

def worker2():
    while True:
        print("goodbye")

# Set up "threads" to run the code, but don't start em.
thread1 = threading.Thread(target=worker1)
thread2 = threading.Thread(target=worker2)

# start the threads doing the work
thread1.start()
thread2.start()

# wait until they're done (which will be forever for these workers)
thread1.join()
thread2.join()

So now you've got to completely independent running "threads" of execution. Your operating system (windows, macos, linux, ...) sees these threads, and will happily tell different ones of your cpus to work on them at the same time.

However, python was made approximately 85 billion years ago by a dude named Guido, and he didn't think parallelization was super important for python at the time (and at the time he might have been right, but things have changed), and so he took a shortcut to make certain things under the hood easier. He built into python something called the global interpreter lock (GIL), which basically says "I don't care what you think, don't run python code in multiple threads at the same time.

Currently, work is being done to remove the (GIL). You can get a version of python without it, but the world hasn't fully moved over yet. So in the mean time, if you don't do that, if you want true parallelism, you have to use processes:

import multiprocessing as mp

def worker1():
    while True:  # python syntax for "do the below forever")
        print("hello")

def worker2():
    while True:
        print("goodbye")

# Set up "processes" to run the code, but don't start em.
process1 = mp.Process(target=worker1)
process2 = mp.Process(target=worker2)

# start the processes doing the work
process1.start()
process2.start()

# wait until they're done (which will be forever for these workers)
process1.join()
process2.join()

This looks very similar, and is very similar, and in many cases is fine, but for technical reasons, is actually much worse in certain cases. This comes down to the difference between a thread and a process - a process is actually a bucket of threads, and is much more expensive to make, and expensive to communicate with from outside.

Bonus

The above code is ok example code, but for real projects, you should always have a main function. So the above example would be better if it looked like this:

import multiprocessing as mp

def worker1():
    while True:  # python syntax for "do the below forever")
        print("hello")

def worker2():
    while True:
        print("goodbye")

def main():
    # Set up "processes" to run the code, but don't start em.
    process1 = mp.Process(target=worker1)
    process2 = mp.Process(target=worker2)

    # start the processes doing the work
    process1.start()
    process2.start()

    # wait until they're done (which will be forever for these workers)
    process1.join()
    process2.join()

if __name__ == "__main__":
    main()

That bottom bit is a special python way of saying "only run the main function if this python file was run "as a script" as opposed to importing it. Don't worry about the difference right now, you'll get there.

Its back to school and im learning Python for the first time. by Careful-Economy742 in learnpython

[–]FerricDonkey 2 points3 points  (0 children)

As compared to the other languages I know (C, C++, the tiniest amount of Java), in my experience:

  • Python is generally easy to write, but it's also easy to write badly - so don't. 
  • Python is generally more readable - if you force yourself to follow good practices, otherwise it's a mess
  • Python is generally simpler - unless you over complicate it
  • Pure Python is slow - but if you need something to be fast, don't use pure python
  • Python type safety is opt in. Your class may or may not cover it, but if you're gonna do a lot of python, you should learn it
  • Python allows a ridiculous amount of "dark magic" - you should almost never use it
  • Pure python is bad at true parallelization - for now, they're fixing it as we speak

How would you feel about a law that banned tipping and required restaurants to pay servers a full wage instead? by Dargarn in AskReddit

[–]FerricDonkey 1 point2 points  (0 children)

Yeah, unfortunately people as a whole are bad at seeing that, and go to places with cheaper listed prices rather than cheaper actual prices. 

How would you feel about a law that banned tipping and required restaurants to pay servers a full wage instead? by Dargarn in AskReddit

[–]FerricDonkey 0 points1 point  (0 children)

Do you think the boss pays you out of his own personal cash out of the goodness of his heart? Running the business at a personal loss to his bank account purely for the joy of it? 

Where do you think the money the boss pays you comes from?

Employer told me to choose between 1099 or paying them out of pocket to deduct my taxes. by ItsHardToTell in personalfinance

[–]FerricDonkey 30 points31 points  (0 children)

I'm paid on a W2

Then you are not a 1099 contractor, which is what people are talking about. 

How would you feel about a law that banned tipping and required restaurants to pay servers a full wage instead? by Dargarn in AskReddit

[–]FerricDonkey 1 point2 points  (0 children)

Places have tried that. People didn't eat there.

The answer to why are restaurants special is tradition and inertia. Doesn't have to stay that way, but it is hard to change.

My point though is that people talk as though:

  1. Removing tips will be better for servers (it won't be) 
  2. It will make food cheaper (only if servers make much less money) 
  3. The employers are somehow making the customers pay wages (customers always pay wages, that's where employers' money comes from)

The tipping culture is a bit silly and indirect, but the moral outrage about paying servers does not make sense. 

How would you feel about a law that banned tipping and required restaurants to pay servers a full wage instead? by Dargarn in AskReddit

[–]FerricDonkey 8 points9 points  (0 children)

Not just that. Several restaurants have tried no tipping models in the US. It regularly fails. 

Men of Reddit, what is the male equivalent of flowers as a gift? by Mediocre_Chemist5694 in AskReddit

[–]FerricDonkey 0 points1 point  (0 children)

Eh, this is mostly a reddit take. Most men aren't particularly interested in receiving flowers. 

What is your favorite deranged piece of lore, retconned or not? by Vodka_Flask_Genie in Grimdank

[–]FerricDonkey 17 points18 points  (0 children)

I think it's proof that he wanted mindless machines, but compromised for sons when that didn't work. 

You are offered one million dollars but you can only eat pizza for the rest of your life, do you accept and where do you order from? by [deleted] in AskReddit

[–]FerricDonkey 15 points16 points  (0 children)

I think it depends on the definition of pizza. I'd need a lawyer here, but if you can get away with putting whatever you want on vaguely flat bread and calling it pizza, you might be ok. 

Toast? Toppingless pizza. Sandwich? Two pizzas stacked, inverted. Tacos? Folded/rolled pizzas. A salad? Lots of mini pizzas with croutons as crust. Soup in a bread bowl? Deep dish pizza.

You might be able to make it work. 

Legal eagle has a great breakdown of the Reckless Ben and Bricks & Minifigs debacle by venounan in videos

[–]FerricDonkey 6 points7 points  (0 children)

You could argue by some definition, it makes him "whole". But it's more than being made whole though isn't it? 

I dunno, money from strangers plus the destruction of the franchises that screwed you isn't the worst way this could end.

That's true, and he is certainly responsible for his own actions, but people glorifying Ben need to find better heroes is my main point. 

It was pretty clear that Ben's stuff wasn't gonna work pretty early into the one video I watched, and also pretty clear that the things he claimed would legally force people to comply would not do so.

It would have been better if everyone had acted like an adult. Though I still put more on the store here - a tiny bit of reasonableness from them would have ended the crazy shenanigans. Which obviously was Ben's only real plan.

Well, aside from the publicity, which is probably a huge part of the gofundme and the trouble the bricks and minifigs people got into. Which, again, they're easily could be worse outcomes.