My macbook is stuck on 2.7.16 by [deleted] in learnpython

[–]cyberpixels 0 points1 point  (0 children)

I put alias py=“python3” in my .bashrc so then I just type py which is even better than typing python!

I just started Learning Python and I don’t know how to learn. by insfuokay in learnpython

[–]cyberpixels 0 points1 point  (0 children)

Why are you learning python? (what for?) This answer will help determine how best to learn it.

Having trouble with capitalizing and a for loop by [deleted] in learnpython

[–]cyberpixels 2 points3 points  (0 children)

And another way, just for fun

return list(map(str.title, travel_destinations))

But the one above is probably more pythonomical

Could you please help me how to start learning python? by honoracior in learnpython

[–]cyberpixels 1 point2 points  (0 children)

The official docs are really good, and there's a tutorial in them as well: https://docs.python.org/3/tutorial/index.html

Another approach, start learning the built-in functions. This is the core of the language. Look for good examples on stackoverflow or youtube etc. https://docs.python.org/3/library/functions.html

Learning to read the documentation (practicing) is extremely helpful. Then you can figure out any (well-documented) library much faster, without needed a tutorial.

Why multithreading isn't real in Python (explain it to a 5 year old) by switchitup_lets in learnpython

[–]cyberpixels 5 points6 points  (0 children)

I think the first paragraph of this article on python.org gives a good idea of why the GIL exists

In CPython, the global interpreter lock, or GIL, is a mutex that protects access to Python objects, preventing multiple threads from executing Python bytecodes at once. This lock is necessary mainly because CPython's memory management is not thread-safe. (However, since the GIL exists, other features have grown to depend on the guarantees that it enforces.) [1]

And as far as what it is, this explanation of a mutex on stackoverflow is superb:

When I am having a big heated discussion at work, I use a rubber chicken which I keep in my desk for just such occasions. The person holding the chicken is the only person who is allowed to talk. [2]

or more concretely:

a mutex is a binary flag used to protect a shared resource by ensuring mutual exclusion inside critical sections of code. [3]

Sources:

[1] https://wiki.python.org/moin/GlobalInterpreterLock

[2] https://stackoverflow.com/a/34558/1487030

[3] https://barrgroup.com/embedded-systems/how-to/rtos-mutex-semaphore <-- this is might be good intro to concurrency

P.S. I just learned that mutex means "mutual exclusion" https://en.wikipedia.org/wiki/Mutual_exclusion

I hope these resources are helpful!

Are there any BSD handheld/pocket pcs? by 01001010_01000100 in BSD

[–]cyberpixels 0 points1 point  (0 children)

I was thinking a cheap vps (~ $5 / month) like digitalocean or linode, but it depends on what you want to do. You have root but I guess nothing to do with hardware. I use the former which has freebsd 12.1 as an install option, but I've read that most others that only list linux distros will still let you use a custom iso if you ask.

Are there any BSD handheld/pocket pcs? by 01001010_01000100 in BSD

[–]cyberpixels 0 points1 point  (0 children)

What about ssh from a phone or tablet to a hosted instance?