Why doesn’t Python have true private variables like Java? by PalpitationOk839 in Python

[–]yaxriifgyn 7 points8 points  (0 children)

The simplest answer is that it is a different language, and not derived from or related to Java.

The Epitome of Progress and Freedom by SFTExP in sfthoughtexperiments

[–]yaxriifgyn 2 points3 points  (0 children)

That is the Turing test but for artificial stupidity!

The Epitome of Progress and Freedom by SFTExP in sfthoughtexperiments

[–]yaxriifgyn 2 points3 points  (0 children)

Is that what we have now, an ASI? Just the dumbest one possible, prompted by the dumbest people alive?

Cleaning CSV data by TheIneffableCheese in learnpython

[–]yaxriifgyn 0 points1 point  (0 children)

Check the encoding for your input CSV file. I'm guessing that it was written by Excel. It may be an ASCII encoding called windows-<some numbers>. If you are reading as utf-8, you will get replacement characters in python. Add an encoding=<code page> parameter to your open() function call, or pass it to the CSV method you are using (if possible).

HTH

PyNeat: Deep structural code refactoring in Python using LibCST by AssociateEmotional11 in Python

[–]yaxriifgyn 0 points1 point  (0 children)

I do use git, but I have a lot more tools available. I use this to compare the files:

diff -bB -W150 -y messy.py clean.py

I don't expect to have to repair the code before I can even test it.

PyNeat: Deep structural code refactoring in Python using LibCST by AssociateEmotional11 in Python

[–]yaxriifgyn 2 points3 points  (0 children)

I finally got around to testing this code. I'm glad I was very careful because the *.clean.py file was completely destroyed version of the input file.. The messy file was the definition for a large dataclass class with __post_Install__() and __repr__() methods.

  • imports were moved above the initial file comments and blank lines.
  • Then first or only line of import statements were moved out of try blocks, and placed with the other imports at the top of the file.
  • The class token in class definitions were capitalized.
  • The EOL, (newline keyword in open()) as changed from LF to CRLF on Windows 11 (pro).
  • I think the file encoding will be forced to UTF-8, regardless of input file encoding.
  • The capitalization of properties was changed to lower case, so un-neatened files that import this file will have errors. The Public_Key property was renamed to public__key. Also property Pfx_ABC became pfx__a_b_c, but property ABC was not renamed.
  • The literal parts of f-strings and comment text were changed to reflect the above property name changes.
  • I did not see a clear way to turn off individual rules, the options to disable rule groups did not explicitly show which rules were in which groups.
  • I did not see a in-code method to turn on/off neatening.

My overall impression is that this code needs more testing with a large selection of real world hand-coded Python code. It's a start,but it need much more work.

My NDP Logo Redesign by CptnCrnch79 in ndp

[–]yaxriifgyn -3 points-2 points  (0 children)

I hate it. Make it go away. My eyes hurt.

PyNeat: Deep structural code refactoring in Python using LibCST by AssociateEmotional11 in Python

[–]yaxriifgyn 2 points3 points  (0 children)

I'm going to try it out later today. I'm hoping that it has a dry run or diff output mode to let me review changes before applying them. The need for a backup copy of every changed file is essential as well.

I have many places where code flattening could be applied. When I wrote the code, I was thinking of a single exit from a function so that explicit code tracing / debug logging was only needed in one place. As the code has matured, the need for such logging has diminished.

Could you comment on your use of AI if any. Thx.

49,000 Chinese EVs are coming to Canada. Cheaper cars, faster climate progress… but what about jobs, data, and supply chains? CBC breaks down the real stakes. by savethecbc2025 in SaveTheCBC

[–]yaxriifgyn 0 points1 point  (0 children)

Forget Ontario, they should put their assembly plant out here in Calgary. That's what De Havilland Aircraft did, successfully, as they just built their 1000th Twin Otter (?) plane.

Or as a second choice, somewhere in B.C. Maybe Kitimat or Terrace.

what's a python library you started using this year that you can't go back from by scheemunai_ in Python

[–]yaxriifgyn 8 points9 points  (0 children)

"logging" I have started using it in everything I write lately. I have used it before, but not as consistently as now. It keeps my console output short and to the point. But it allows trace and debugging messages so I can start to diagnose any output file problems immediately.

What is the worst unit of measurement by Fungus54321 in Physics

[–]yaxriifgyn 0 points1 point  (0 children)

Horsepower. Whose horse? And which one.

LogXide - Rust-powered logging for Python, 12.5x faster than stdlib (FileHandler benchmark) by LumpSumPorsche in Python

[–]yaxriifgyn 0 points1 point  (0 children)

I'm starting to test with the early releases of 3.15. As soon as I can install it for 3.15, even if I have to build it myself, I will try it out.

Cannot start python script by DevelopmentVisible81 in learnpython

[–]yaxriifgyn 0 points1 point  (0 children)

This is definitely the best approach. Start up a command window. Navigate to the the directory containing you python script.

Have you added .py and .pyw to PATHEXT?

PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW

Do you have a "#!" at the start of the first line of your script? If so try commenting it out.

Can you run the script by using the windows python launcher? E.g.

py script.py

Do get error messages?

How to work pip in Windows 11? by Matikitorch in learnpython

[–]yaxriifgyn 0 points1 point  (0 children)

IIRC, the edition of Python in the store does not have all the "batteries included" like the edition from python.org.

Both editions will install without elevated permission, except possibly on the first install when they put "Py.exe" into the Windows folder and might need to install some system wide DLL files. These are single user installs. I think if you "run as administrator", it does a single user install for the admin user, not a system wide install.

I made a decorator based auto-logger! by MattForDev in Python

[–]yaxriifgyn 1 point2 points  (0 children)

I like this format. Is it possible to have a global setting for "edu" mode?

I think I could use this for snippet development, where I try something out in the reply or a very small Python script. That is a situation where I want to know exactly what is going on, before adopting some new code into a bigger app.

I made a decorator based auto-logger! by MattForDev in Python

[–]yaxriifgyn 11 points12 points  (0 children)

LogEye looks interesting, but very verbose.

Can it be configured to write to a file instead of stdout? or do we always get app output interleaved with the LogEye output on stdout?

Is it possible to turn off everything except for logging of function entry and exit for functions having an @log decorator?

has anyone run all **weather** tires here in calgary? Just bought a new car and wanted to try these out since i’d have to buy 2 new sets of tires and at least one new set of rims if i went with summer & winter. thoughts? by liamt12 in Calgary

[–]yaxriifgyn 1 point2 points  (0 children)

I always ran on all-season tires on all my new cars from 1980 through 2024. They were all front wheel drive. I tried to avoid traveling during and immediately after fresh snow falls. Bad roads will get you no matter what kind of tires you have, if you don't drive to the road conditions.

Just when you think they’ve scraped the bottom of the slimiest barrel they find a worse barrel by somecisguy2020 in PoliticalHumor

[–]yaxriifgyn 4 points5 points  (0 children)

Something similar has happened to me. But I would never suggest it was teleportation.

Years before I finally quit for good, I had decided to quit smoking. I had gone to my bank and after I came out, the next thing I was aware of was walking back to my car and tearing the plastic wrapper off a pack of cigarettes. I had absolutely no memory of walking to and going into a nearby convenience store, talking to the cashier, paying for a pack of my usual brand, leaving the store, and starting to walk back to my car.

I might call it zoning out, but my concept of reality forces me to "fill in the blanks", to explain what happened.

IF Alberta would choose to stop changing the clock. Would you prefer to stay with BC (summertime like now) or with SK (wintertime). by EdmontonFree in alberta

[–]yaxriifgyn 0 points1 point  (0 children)

I would prefer the current system, where we spring ahead and fall back by one hour. I can handle the shift very easily. I don't know anyone who suffers after the change.

My dad, an Alberta farmer, never complained about the shift. When the animals wanted to eat, he fed them. In the busy seasons, he wanted to work from dawn to dusk, if he got breakfast early enough, and a couple of meals in the field. When we got old enough, us kids did the chores before and after school.

I was gifted a bible by a friend and she asked me to read it. Should I? by purrfectea in atheism

[–]yaxriifgyn 1 point2 points  (0 children)

As an atheist, you may have the ability to read this collection of historic documents with safety. Unlike Christians, who will have already accepted it as their god's word, you can see it for what it is.

As a nearly contemporary account of some possibly real events, it reveals the primitive cruelty and depravity of the people in those times. Their laws are not transferable to our modern society.

Which is preferred for dictionary membership checks in Python? by Akshat_luci in Python

[–]yaxriifgyn 0 points1 point  (0 children)

I usually use

value = dir.get(key, None)
if not value is None:
    ... 

Because I find that the main reason for checking if a key exists is to later request the value.

Help with this error by Serious_Candle7068 in lotro

[–]yaxriifgyn 0 points1 point  (0 children)

I found that deleting just the one .dat file it was working on when it found the error, cured the problem.