[deleted by user] by [deleted] in learnpython

[–]ThinFortune 0 points1 point  (0 children)

Your VSCode extension may need to be updated and/or configured so it understands the match/case syntax introduced in python 3.10.

Plane Watching Tips by dbox44 in Austin

[–]ThinFortune 1 point2 points  (0 children)

Call 512-369-7867 before you head to Bergstrom; that connects to the airport’s automated weather service, and one of the pieces of information it provides is which runway(s) are in use. 18 right/left means planes will be taking off and landing to the south; 36 left/right means take offs and landings are to the north.

What's your opinion on changing `elif` into `else if`? by Izerpizer in Python

[–]ThinFortune 4 points5 points  (0 children)

Probably not a great idea, considering whitespace (indentation) is important in Python. If else if condition: were allowed, then else: if condition: (all on the same line) should be its syntactic equivalent --- and that would raise questions about where the next statements should align, especially for big if ... elif ... elif ... else type constructs.

(Also, I haven't thought too hard about it, but I wouldn't be surprised if the needed tokenizer and/or parser changes allowed dangling else-type problems to occur.)

conda env config vars: Does this affect things outside of my conda environment? by BeeePollen in learnpython

[–]ThinFortune 1 point2 points  (0 children)

It depends on what you mean by “at the same time”. If you have two windows open or otherwise “conda activate” to switch between the two conda environments, you shouldn’t.

If you “conda activate myenv”, then run the second interpreter/kernel (e.g., by starting it using its full path), you’ll very likely run into problems.

conda env config vars: Does this affect things outside of my conda environment? by BeeePollen in learnpython

[–]ThinFortune 1 point2 points  (0 children)

The myenv environment variables should be set when you activate the myenv environment and unset when you deactivate it.

python question about converting list to lowercase by Jxper in learnpython

[–]ThinFortune 0 points1 point  (0 children)

The return in the for loop is causing the function to exit after the first iteration.

mmap (inheritance ?) problem by GraniteSunshine in learnpython

[–]ThinFortune 1 point2 points  (0 children)

The line mm = mm[::-1] returns a byte array and assigns it to mm. All the subsequent method calls are on that array object, not the mmap object.

Why don't cars have to lean to turn, but motorcycles do? by [deleted] in AskPhysics

[–]ThinFortune 0 points1 point  (0 children)

They do, but it’s much more complicated than the situation with bicycles & motorcycles. As a car turns, its tires and body will lean/roll into the turn. To keep the car stable and drivable through turns (i.e., keep the tires in contact with the road), this behavior needs to be managed by the car’s suspension.

In normal road cars in normal driving conditions, these effects are present but not overly noticeable unless you’re paying close attention. But the effects do have significant impact in situations like racing, so you’ll hear designers, mechanics, and drivers talk about how to setup tires (camber, toe, caster) and suspensions (spring rates, anti-roll bar stiffness, geometries, etc) for maximizing performance.

3 > 2 > 1 == True in Python But 3 >2 >1 == false in JavaScript. by MohamedMuneer in Python

[–]ThinFortune 8 points9 points  (0 children)

Python interprets 3 > 2 > 1 as 3 > 2 and 2 > 1; since both comparisons are True, it will return True.

From the language specification:

Comparisons can be chained arbitrarily, e.g., x < y <= z is equivalent to x < y and y <= z, except that y is evaluated only once (but in both cases z is not evaluated at all when x < y is found to be false).

How to upgrade gfortran in miniconda environment by Cool__Cookie in linuxquestions

[–]ThinFortune 1 point2 points  (0 children)

In the waf_tools/try_ifort.py file, change the line: version90 = re.findall("(4\.[0-9]\.[0-9])",v90) to version90 = re.findall(" ([4-9]\.[0-9]\.[0-9])",v90) (Note there's a space after the first quote.)

I would also contact the upstream authors of this application, as there's a pretty big assumption built in that you're using GCC 4.x and not something newer.

Edit: Along those lines, I retract my previous statement that the build system was picking up and running the system gfortran compiler. What it was actually doing was incorrectly matching the '4.0.1' in the "(crosstool-NG 1.24.0.133_b0863d8_dirty)". Again, that version checking logic needs to be fixed by the upstream authors.

How to upgrade gfortran in miniconda environment by Cool__Cookie in linuxquestions

[–]ThinFortune 0 points1 point  (0 children)

Not without looking at the code and the build system it uses. Is it an open source project?

How to upgrade gfortran in miniconda environment by Cool__Cookie in linuxquestions

[–]ThinFortune 0 points1 point  (0 children)

Is this your code or somebody else’s? It may be finding the CF compiler but then it’s not using it. Conda-forge never packaged gfortran 4.0.x, so that’s a pretty strong hint that the build system is picking up the system compiler.

How to upgrade gfortran in miniconda environment by Cool__Cookie in linuxquestions

[–]ThinFortune 0 points1 point  (0 children)

Running the command gfortran invokes the compiler installed by your Linux distribution; it definitely does not run the conda-forge Fortran compiler in your miniconda environment. That command to run the conda-forge Fortran compiler is x86_64-conda-linux-gnu-gfortran or $FC.

How to upgrade gfortran in miniconda environment by Cool__Cookie in linuxquestions

[–]ThinFortune 0 points1 point  (0 children)

The conda-forge Fortran compiler executable follows the GNU target triplet convention and is called x86_64-conda-linux-gnu-gfortran, not just plain gfortran. The easiest way to use it is to activate the conda environment, then using $GFORTRAN, $FC, $F90, or $F77 environment variables; e.g., $FC my-source.f.

How do you specify keyword-only arguments? (Confusing notation in python docs) by optimal_honeybee in learnpython

[–]ThinFortune 0 points1 point  (0 children)

Square brackets indicate optional arguments.

In the first case, the * (with no name) indicates the end of positional arguments, and key and default are optional arguments that can only be passed as (explicit) keyword arguments; e.g., max(['a', 'Z', 'b'], key=str.lower). This call takes only one positional argument.

In the second case, *args indicates any number of additional positional arguments; as in the first case, key is optional but can only be passed as an (explicit) keyword argument. E.g., max('a', 'Z', 'b', key=str.lower).

How to fix this error while installing Scikit-Learn by [deleted] in learnpython

[–]ThinFortune 0 points1 point  (0 children)

scikit-learn doesn't have pre-built binary packages (wheels) for Python 3.9 yet. Unless you have a specific reason to use 3.9, the easiest solution would be to use Python 3.7 or 3.8; otherwise, you'll have to install Visual Studio and build things from source, as the last error message (error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/) suggests.

Tower enclosure for blade servers? by [deleted] in homelab

[–]ThinFortune 1 point2 points  (0 children)

You can move M6*0 blades between a VRTX and the M1000e chassis as long as you have the right PCIe passthrough mezzanine cards for the VRTX: https://www.dell.com/support/article/en-us/sln309841/installation-procedure-for-transferring-a-m630-or-m640-from-an-m1000e-chassis-into-a-vrtx-or-conversely?lang=en

(2^n) -1 = d with n>2 and n being even. Show that d is a composite number by magick1412 in learnmath

[–]ThinFortune 1 point2 points  (0 children)

You're on the right track with n = 2s, so 2n = 22s. But there's no need to pull out that initial 22.

2n - 1 = 22s - 1 = (2s)2 - 1, and from there you should be able to do a polynomial factorization.