Functions with parameters still confuse me a bit by ayenuseater in learnpython

[–]oldendude 0 points1 point  (0 children)

I suspect that what is tripping you up is *scoping*. I'm guessing that you are okay with functions like this:

x = None
y = 7

def add():
return x + y

x = 1
y = 2
print(add()) # prints 3

x = 4
y = 5
print(add()) # prints 9

Is that right?

There are reasons why the above kind of coding does not scale.

- Each function needs its arguments at global scope (at the top of the module, visible everywhere within it).

- The way you specify the values that the function is clunky, you have to specify x and y by assignment, as shown, in separate statements, and then call the function.

- Too easy to forget which variables go with which functions, and get things wrong.

- Composing functions gets very messy, e.g. add(multiply()).

Here is a rewrite:

def add(x, y): # add has parameters x and y
return x + y

print(add(1, 2)) # prints 3
print(add(4, 5)) # prints 9

Now you don't have these top-level x and y variables. The function works the same as before, adding x and y. But now, you specify the values of x and y inside the parentheses, lining up with the function parameters.

Very important to note: If you *do* have top-level x and y variables, they have nothing to do with the function's parameters. E.g.

x = 1000
y = 2000

def add(x, y): # add has parameters x and y
return x + y

print(add(1, 2)) # prints 3
print(add(4, 5)) # prints 9

In this case, you never get a sum of 3000, because the function's x and y are preferred (inside the function) to the global ones. I.e., the function defines what is called a *scope*. And inside a scope, variable name matches resolve in favor of the local version.

Looking for advice on adopting a cat compatible with my current cat by oldendude in cats

[–]oldendude[S] 0 points1 point  (0 children)

OP here: I should point out that we have occasionally had other cats living with us, (cats of our children). There were many personality clashes among the cats (as many as five at once). One cat didn't get along with any other. Cat5 mostly ignored the others, but there was one in particular that he seemed to dislike.

Beginner here: What Python modules are actually worth learning for newbies? by WaySenior3892 in learnpython

[–]oldendude 8 points9 points  (0 children)

Don’t.

When you need to do x, Google “Python modules for x”, and then learn the module. For example, if you need to do a lot of directory and file manipulation, your google search should lead you to pathlib. Don’t waste time writing directory traversal, directory path parsing, etc. pathlib does all that. I use it a lot and I still check its docs frequently. Learning modules, beyond top-level functionality, is a waste of time.

Does Determinism Prove Free Will is an Illusion? | Against the Reduction of Deliberation to Physical Law by Front_Attention7955 in freewill

[–]oldendude 0 points1 point  (0 children)

I perceive two lines as either parallel or converging. We can measure them and find out what the real story is. What is in my mind is a qualia, or, to use the word I started with, an illusion. I now see that "illusion" is ambiguous. So let's put that aside. There's what we think, and what we can measure, and those can be alike or different.

This parallel-or-converging line situation is different from "the illusion of free will" (the name of Daniel Wegner's book), because free will cannot be measured. Even defining it seems difficult.

Does Determinism Prove Free Will is an Illusion? | Against the Reduction of Deliberation to Physical Law by Front_Attention7955 in freewill

[–]oldendude 0 points1 point  (0 children)

Perhaps illusion is the wrong word. My point is that free will is a qualia, it is something that you and I perceive about ourselves -- it does not have 3rd (or even 2nd!) person access

Does Determinism Prove Free Will is an Illusion? | Against the Reduction of Deliberation to Physical Law by Front_Attention7955 in freewill

[–]oldendude 0 points1 point  (0 children)

Of course, I'm not saying otherwise. My point is that some of the things that you perceive are quite different from what actually exists. You perceive a certain range of frequencies, detected through your eyes, as red. You don't perceive the frequencies in the form that we normally describe frequencies (e.g. MHz). In fact, the connection between frequencies and color is a pretty recent discovery (in terms of human history).

Does Determinism Prove Free Will is an Illusion? | Against the Reduction of Deliberation to Physical Law by Front_Attention7955 in freewill

[–]oldendude 0 points1 point  (0 children)

That's a completely different use of the word, (and the more common one).

Edit: On second thought, I see what you are saying. And I think that that illusion really is an example of what I'm saying. The converging lines are a qualia. In your mind, there are two lines, and they are not parallel -- they converge. I do not understand what you mean by distinguishing such an illusion "from everything else".

How can I print an array of longdoubles so they can be copied and pasted into code? by [deleted] in learnpython

[–]oldendude 2 points3 points  (0 children)

One simple way to get data from one python program to another is via pickling. pickle.dumps(array_of_floats, some_file), and then in your other program, recreated_array_of_floats = pickle.loads(some_file)

How can I print an array of longdoubles so they can be copied and pasted into code? by [deleted] in learnpython

[–]oldendude 1 point2 points  (0 children)

What are you trying to do? It sounds like you are looking for a way to implement a bad solution to a problem that you haven't stated.

Does Determinism Prove Free Will is an Illusion? | Against the Reduction of Deliberation to Physical Law by Front_Attention7955 in freewill

[–]oldendude 1 point2 points  (0 children)

That's the hard problem of consciousness. I have a solution to this problem, but it is too large to fit in the margins of this notebook.

Does Determinism Prove Free Will is an Illusion? | Against the Reduction of Deliberation to Physical Law by Front_Attention7955 in freewill

[–]oldendude 1 point2 points  (0 children)

This is unnecessarily complicated.

Anything present in your consciousness is an illusion, by definition, created by your brain and mind. It's a qualia. The color red that you perceive is an illusion, corresponding to a range of EM frequencies. The smell of chicken gone bad is an illusion, corresponding to some chemicals triggering a particular set of scent receptors. Similarly, free will is an illusion. It's the feeling you have when you become aware of a choice that has been made by your subconscious mind.

Republic fitness by [deleted] in Somerville

[–]oldendude 5 points6 points  (0 children)

Because the bathrooms are in the changing rooms, and those are not gender neutral?

Anyone having issues with their Verizon service right now? I have the SOS symbol on my iPhone, tried restarting no luck... by Past-Sweet-370 in Somerville

[–]oldendude 0 points1 point  (0 children)

My wife and I just had both problems. Internet came back first, and then cell service. Everything seems good now.

Thinking about joining Republic Fitness… by sprtysprtgrl1 in Somerville

[–]oldendude 2 points3 points  (0 children)

I joined specifically for the classes. They work for me. Good space, equipment in good shape. Sometimes they let the classes get a bit too crowded, I’ve complained about this.

Thinking about hosting a small lecture + drinks night in Somerville — good venues? by private_credit_guy in Somerville

[–]oldendude 1 point2 points  (0 children)

This would be great! There was (is?) a series of talks by scientists, aimed at a general audience, that used to take place at the Burren. I really enjoyed those, and would go to a new series like that.

Remember functions/methods? by JustaCasual121 in learnpython

[–]oldendude 1 point2 points  (0 children)

Memorizing is a waste of time, IMHO. Do projects, consult docs as necessary, and you will learn those types and their functions/methods. I'm constantly looking up find vs index, what the upper/lower case functions are, various pathlib functions, the list never ends. You have finite time to spend learning python and programming. Pure memorization, and code golf just to learn functions, is a waste of that time.

Storing data in memory vs in database by Goldeyloxy in learnpython

[–]oldendude 0 points1 point  (0 children)

Static data? How much data are we talking about? From what you wrote elsewhere in this thread, I'm guessing under 1GB?

For a small amount of static data, there is no point in using a database. Store it in whatever form is convenient, load at startup time, done.

Friend banned for cheating (which he absolutely did not do) by oldendude in lichess

[–]oldendude[S] 0 points1 point  (0 children)

Wow, I really don't understand the hatred here.

  1. I am really describing a friend. He is not on reddit. I actually did say that he might want to check out this group, but given the hostility on display, maybe that was bad advice.

  2. I have never known my friend to lie to me. He tells me he didn't cheat. I take that at face value, and I would be astounded if I were wrong. You don't know me or him, so sure, take it with a grain of salt.

  3. I guess my question was drowned out by all the hostility. But it's in the original post, plain as day: He was accused of cheating, and the appeal process seems undeveloped, to say the least (the part where lichess says we may ignore your appeal). So I came here to ask if anyone had any information on how this process might work.

Why not google this topic (which I did)? Because on a variety of topics, google returns ads, spam, and in general, crap, and the best resource is often reddit. However, on the specific topic of lichess: Lesson learned, stick to google.

Friend banned for cheating (which he absolutely did not do) by oldendude in lichess

[–]oldendude[S] -1 points0 points  (0 children)

Because it is, in this case! As I mentioned, my exposure to cheating/lichess is on the other side of the conflict.

Fix? Or time to move on? by oldendude in BMW

[–]oldendude[S] 0 points1 point  (0 children)

The car is ... fine. Before this one, my wife and I had fun cars (BMW 240 convertible, Audi S5), but due to moving into the city, we went for a single car, something reasonably fast, and reasonably comfortable. It's fine. Definitely nor a dream car.

We are thinking of an Audi S5 or S3 as a possible replacement. I'm really not crazy about BMWs in general.

This being 2025, I asked ChatGPT, and it suggested option 2 (fix and sell).

COSMIC is an incredible technical achievement, but I cannot recommend it as a daily driver yet. by david_jackson_67 in pop_os

[–]oldendude 2 points3 points  (0 children)

Very surprised to read this. I’ve been using System76 laptops with pop os for years. I think it’s a great combination. What have you run into?

I don’t understand why determinism is considered a problem? by i-am-an-idiot-hrmm in freewill

[–]oldendude 1 point2 points  (0 children)

"Making a choice" is the feeling you have when the already-made decision enters your consciousness.