Search
Items tagged with: Python
Using #Cayley as my knowledge graph with #python. (Entities and their relationships are in RDF N-quad format: "subject", "predicate", "object", "label".) But I can barely wrap my head around the Gizmo API syntax. Only simple queries make sense to my tiny brain! Like this returns all the predicates:
`query = graph.V("<predicates>").Out("<are>").All()`
And this returns all the things known about "Bob":
`query = graph.V("Bob").Out().All()`
But what about all predicates for Bob?
🤔
Well, count me among the ranks of the laid-off tech workers. I've done plenty of #perl for a couple lifetimes. But for the past years have done a lot of #python, #node and #typescript as well. Check out https://github.com/ology for more exciting details! 😁
ology - Overview
Epistemologist-at-large. ology has 145 repositories available. Follow their code on GitHub.GitHub
I would expect first option to be the result but in presence of “absolute” path component, “os.path.join” throws out everything before.
I do not buy the explanation behind that. I have been aware of the misbehavior since fucking behavior bit me earlier.
“pathlib” is also similarly afflicted.
"Finding the perfect colors for your Python chart can be daunting," says Yan Holtz. "Luckily, the all-new PyPalettes package provides a collection of 2500+ palettes meticulously curated by hundreds of experts."
Holtz's Python Color Palette Finder Web app "lets you effortlessly explore various palettes and gives you two lines of code to use directly in your Matplotlib chart. Discover the perfect palette to make your chart stand out! 😍"
https://python-graph-gallery.com/color-palette-finder/
Python Color Palette Finder
Browse 2500+ color palette. Find the perfect match for your Python Chart. Get the matplotlib code.The Python Graph Gallery
Today I was reading about quantum computers only being able to do math that is reversible.
That means they cannot do exponents in the standard way, because a positive exponent is impossible to unwind, as the result could be positive or negative.
210 = -210 = 256
But there is a way to do it that quantum computers are fine with. Here is my python code example of it.
You'll recognize the weird nth_fib from a previous post of mine. So you could argue that this is doubly-weird.
Try it out, and let me know if you have any ideas or improvements for bibonacci_exponentiation(). Otherwise, use it to learn a new trick (as I did today).
You can cut/paste the code from the alt text so you don't have to bring out your magnifying glass to type it out manually.
Bonus if you can explain why it works.
Hey, fellow software developers! Sometimes code passes your code bad data. Do you throw exceptions? Return false? Hope for the best? (YOLO)
Would love to hear your reasons why. And please share so other developers can weigh in.
#Developers #Software #SoftwareDevelopers #OpenSource #DivideByZeroAndConquer #Perl #Ruby #Python #Java #CSharp #NodeJS
- Exceptions (71%, 81 votes)
- Return values (23%, 27 votes)
- YOLO (5%, 6 votes)
I didn’t realize that was part of the official #GitHub Desktop package.
They’re gonna have an interesting time when #Apple makes good on its five-year-old deprecation of #Perl from #macOS: https://TidBITS.com/2019/06/25/apple-to-deprecate-scripting-languages-in-future-versions-of-macos/
#PHP and #Python 2.7 already got the axe.
Current macOS #Sonoma 14.6.1 ships with #Bash 3.2.57 (deprecated in favor of #Zsh), Python 3.9.6, Perl 5.34.1, #Ruby 2.6.10, and #Tcl 8.5.9, all of which issue deprecation warnings on startup.
Apple to Deprecate Scripting Languages in Future Versions of macOS - TidBITS
Apple says future versions of macOS won’t include a number of open-source scripting languages. The impact of this change will vary depending on the audience, but it will affect more people than you might think.Curtis Wilcox (TidBITS Publishing Inc.)
"Utilizing Miniconda to pull package updates from the Anaconda Public Repository without a commercial license is considered a violation of the Terms of Service."
https://legal.anaconda.com/policies/en/?name=terms-of-service#anaconda-terms-of-service
How much does cost 💲💲 CRAN?
If I am reading this right PyPi #python cost more than 1.8M a month without accountin volunteer and paid employees. Most of it is in the cloud, which #rstats equivalent would be cloud.r-project.org (which I think Posit pays?)
There are also 3 people leading and as CRAN there are other people (but CRAN manually reviews all submissions!).
I think that having mirrors distributed across universities lowers costs but just guessing.
https://dustingram.com/articles/2021/04/14/powering-the-python-package-index-in-2021/
What does it take to power the Python Package Index? - Dustin Ingram
The time, money and services it takes to power PyPI in 2021dustingram.com
From my inbox just now:
"Python purge: What you need to know about the Python Challenge in Florida"
https://www.usatoday.com/story/graphics/2024/08/08/florida-python-challenge-everglades/74668348007/
Python purge: What you need to know about the Python Challenge in Florida
Florida launches annual campaign to remove invasive snakes from Everglades.Jennifer Borresen (USA TODAY)
So... just confirmed an already-reported bug in #Python that some on here may be interested to know about. In at least 3.11 and probably 3.9-3.12+, adding or subtracting datetime.datetime objects which are time-zone-aware and have the same tzinfo will give incorrect results when crossing a time shift in their time zone.
For example, there's a fall-back shift on November 3rd this year in the Eastern US time zone, from EDT (Eastern Daylight Time) to EST (Eastern Standard Time). The zoneinfo module can represent this time zone if you say zoneinfo.ZoneInfo('America/New_York') and you have IANA time zone files on your system (IIRC Windows doesn't). At 1 a.m. on 2024-11-3, an hour repeats, first in EDT and then in EST. Python can represent the repeated hour and convert times from/to UTC mostly correctly, but will give incorrect results when e.g. adding across the transition. For example, 2024-11-03T00:45 EDT plus 1 hour is 2024-11-03T01:45 EDT which python gets right. But plus 2 hours should be 2024-11-03T01:45 E*S*T, which python gets wrong (it returns 2024-11-03T02:45 EST, which is 2 hours later, not 1.
Similarly, subtracting 2024-11-2T00:00 EDT from 2024-11-4T00:00 EST should give a difference of 2 days and 1 hour, but python gives 2 days exactly (it does work correctly if you give the time zones as UTC offsets, but not if you use the same tzinfo object).
Time math is incredibly cursed (see above) so I don't blame the Python devs for this, but I do hope it will get fixed.
My guess is that the code checks if the tzinfo objects are the same and then does simple math if they are, when instead it should have checked whether their utfoffset results were the same. Gotta think whether I have the time to submit a PR for this...
Hey folks, just got laid off after 4 years with my employer.
I’m a 25y veteran python developer (web, backend, and data processing) with many years of experience working remotely for companies in the US and Europe.
I have the most experience working with web, backend and data systems, and am also be drawn to opportunities to improve internal tooling and web services that give coworkers the information and capabilities to do their thing better.
We got ourselves a #remote job. Not my team, but I can answer questions about the company. I've been here 6.5 years which probably tells you all you need to know.
Preferred skills
Programming skills (#Ruby, #Python, #Perl, etc.)
Experience working w/ Puppet
Windows sysadmin
Large scale infra experience
Knowledge of DC management, sys management, and monitoring, networking & security
Tech Support experience in an open source company
Now Hiring: Perforce Software, Technical Support Engineer, Puppet - Remote - US
Role: Technical Support Engineer, Puppet Location: Remote - US Shift: 9:00 AM to 6:00 PM PST Perforce is a community of collaborative experts, problem solvers, and possibility seekers who believe work should be both challenging and fun.www.thegravityapp.com
The final installment in the series:
"The-Quest-For-Performance" from my blog, discussing #python #numpy #numba, #rstats @openmp_arb #openMP enhancements of #Perl code and #simd
Bottom line: I will not be migrating to Python anytime soon.
Food for thought: The Perl interpreter (and many of the modules) are deep down massive C programs. Perhaps one can squeeze real performance kicks by looking into alternative compilers, compiler flags & pragmas ?
The Quest for Performance Part IV : May the SIMD Force be with you
At this point one may wonder how numba, the Python compiler around numpy Python code, delivers a performance premium over numpy.Killing-It-with-PERL
The final installment in the series:
"The-Quest-For-Performance" from my blog Killing It with #perl
Discussing #python #numpy #numba, #rstats #openMP enhancements of Perl code and #simd
Bottom line: I will not be migrating to Python anytime soon.
Food for thought: The Perl interpreter (and many of the modules) are deep down massive C programs. Perhaps one can squeeze real performance kicks by looking into alternative compilers, compiler flags and pragmas ?
submitted by /u/ReplacementSlight413
[link] [comments]
The Quest for Performance Part IV : May the SIMD Force be with you
At this point one may wonder how numba, the Python compiler around numpy Python code, delivers a performance premium over numpy.Killing-It-with-PERL
have been using #python since 2008 and til
(source: https://lobste.rs/s/wnff6n/python_still_surprises#c_ibq0w2)
A couple of data/compute intensive examples using Perl Data Language (#PDL), #OpenMP, #Perl, Inline and #Python (base, #numpy, #numba). Kind of interesting to see Python eat Perl's dust and PDL being equal to numpy.
OpenMP and Perl's multithreaded #PDL array language were the clear winners here.
submitted by /u/ReplacementSlight413
[link] [comments]
The Quest for Performance Part I : Inline C, OpenMP and PDL
Sometimes, one’s code must simply perform and principles, such as aeasthetics, “cleverness” or commitment to a single language solution simply go out of the window.Killing-It-with-PERL
Man! Any URL of "docs.python.org" did not show up in the first set of results for search of "python get login user id": https://duckduckgo.com/?q=python+get+login+user+id&t=ftsa&ia=web 😬
Taking the hint from the Stack Overflow excerpt, edited the URL of one of existing bookmarks😣
Earlier search was without "login" that produced one URL but not what I was looking for.
Are you aware of Veronica Olsen's #novelWriter?
If you haven't taken it for a testdrive yet I think you might be pleasantly surprised 🍔
https://novelwriter.io/ and https://github.com/vkbo/novelWriter/blob/main/README.md
Aside from her life as a physicist she's also a passionate writer and zealous #Trekkie, so her inspiration for creating novelWriter was born of a need to fill a niche.
Live long and prosper 🖖
I hope that helps 😀 Enjoy!
#tallship #FOSS #Python #author #AuthorLife h/t to @veronica
novelWriter/README.md at main · vkbo/novelWriter
novelWriter is an open source plain text editor designed for writing novels. It supports a minimal markdown-like syntax for formatting text. It is written with Python 3 (3.9+) and Qt 5 (5.15) for c...GitHub
Very thoughtful post.
As for #Perl, it hardly “stopped at version 5.” (See @shiar’s summary of changes from Y2K’s 5.6 to last year’s 5.38: https://sheet.shiar.nl/perl.) There simply hasn’t been major breaking changes, unlike, say, #Python.
The community also lacks consensus on the marketing value of a new major version. Some software releases just merrily keep incrementing that number to draw attention and create FOMO, semantic meaning be damned.
A few thoughts on Programming languages
Just a few thoughts on programming languages that have been rattling around in my head this week, but which don’t each merit a full blog post. The main theme is that the culture behind each programming language leads to some interesting choices, as is the case with spoken languages.
This week I started learning how to program in Rust. Even though I’m using the project-based Command-Line Rust to learn, the author still went with the traditional “Hello, world!” project for the first intro to the language. I was also working on a Go project last week and so it immediately stood out to me that (at least as taught by this author) Rust has the print! macro that allows you to succinctly print to the command line. By contrast, Go requires importing fmt before you can print. This was the first topic that was swirling around in my head this week. What makes language designers choose whether printing output (one of the most basic things a program can do) is built-in or requires an import. I even remember back when I was learning Java in undergrad (I think it was Java 1.8, but I don’t remember) we had to use the savitch library just to get program input (another very basic computer program concept). As I thought about it, I wondered if it has to do with thoughts around compilation and whether the language designers think you’re mostly making user-interactive programs or libraries? It makes sense to me that scripting languages like Python, Ruby, and Perl would have print built-in since you always have to have the interpreter along with you, so all the basics should be there. (The original Batteries Included Python promise, for example) But perhaps the Go developers thought you wouldn’t always be printing to the command line so a more efficient binary could be compiled by forcing you to import the functionality? I’m not entirely sure.
The next thing I started thinking about, again due to learning Rust, was the mutability of variables. In most languages I’ve come across (I think all, except Haskell) all variables are mutable by default. It almost seems pointless to have a non-mutable variable. I understand why many languages have the concept of a “contanst” modifier/keyword. Unlike normal variables, THIS ONE does not change. But the opposite seems so weird since most of what we often do in programming involves changing the value in a variable. Perhaps as I learn more about Rust, I’ll understand their reasoning, but this seems completely backwards to me.
Both Rust and Golang use structs to organize variables where Ruby, Python, and Java use objects. But when both Go and Rust allow you to “attach” methods/functions to structs – is there a true distinction between object-oriented programming and struct-based programming? It seems like it’s just semantics (in the generic sense of the word) – at least at the level at which I program. The only difference I can see is that structs don’t have inheritance, although Go’s “types” solve some of the same problems.
Today’s (the day I’m writing this, not the day it’s going to be posted) shower thought was about programming language versions. On one end you have Java (I think now on version 22) and C# (now at version 12). On the other you have Python and Ruby (both at version 3). Perl essentially stopped at 5 with Perl 6 evolving into Raku. I don’t know what Java is up to. But I think C# is actually using the versions correctly – I’ve heard that each version introduces completely different ways of doing things and that the way you program C# depends strongly on when you jumped in. This is why Python is probably never moving to v4 unless they need to make some kind of huge change. Rust is an outlier with year-based versions. I guess that’s fine, but doesn’t tell you anything like a proper semantic versioning could.
Finally, I know that Rust is the newest of all the programming languages I’ve learned, but I really love how new projects are started. Python isn’t horrible, but it’s currently suffering from a lots of ideas, none of which has complete market share. You could do a simple virtual environment or you could do a more complex virtual environment/lock file situation with Poetry. (And there are about another half dozen variations on these two themes) But Rust….Rust deserves a chef’s kiss. When you start a new project with “cargo new project-name”, not only does it set up your directory structure, but it does a whole bunch of great setup tasks. It creates your Cargo.toml file (with Python, which only really started supporting toml files at the project level a few years ago, you need to look at documentation to figure out what goes in there) so that you have all the basics in there already. But it doesn’t stop there! It also, in a nod to modern programming, creates a git repository AND a gitignore file. It’s a thing of beauty. I would absolutely love for Python to move in this direction officially (not through a random user choice) for their defaults. Even “go mod init” could benefit from setting up a git repo and a git ignore (since the toml is not how Go works – I think they would probably best set up a README.md since Go’s default packaging is through git repos).
#Go #Golang #perl #python #Ruby #rust
A few thoughts on Programming languages
Just a few thoughts on programming languages that have been rattling around in my head this week, but which don’t each merit a full blog post. The main theme is that the culture behind each program…It's A Binary World 2.0
An experiment with creating files with invalid UTF-8 names & trying to read in #Python ...
Invalid-UTF8 vs the #fileSystem, 20230914,
by Kristian K,
https://blog.koehntopp.info/2023/09/14/invalid-utf8-vs-the-filesystem.html
Someone on Reddit was asking if there is any way of detecting something in an exoplanet atmosphere which would have no other explanation than life. I'm pretty happy with my answer.
You might be surprised that it even includes #Python code.
#AstroBiology #Science #Astronomy #Life #Software #NASA #SpaceX
Lessons learned: A) Performance freaks to stop using #rstat 's runif for random generation. The Hoshiro random number generator https://arxiv.org/abs/1805.01407 is 10x faster. Implementations in #perl 's #PDL, #rstats (dqrng) and #python #numpy are within 20% of each other B) But does it make a difference in applications? To get to the bottom of this, I coded a truncated random variate generator in #rstats and #perl using #pdl (as well as standard u/perl) using the #GSL packages https://metacpan.org/pod/PDL::GSL::CDF & https://metacpan.org/pod/Math::GSL for accessing the CDF & quantile functions. In this context, it's the calculation of the #CDF that is the computationally intensive part, not the drawing of the random number itself. C) I should probably blog about these experiments at some point. Note that #pdl (but not base #perl) are rather competitive choices for large array processing with numerical operations. I mostly stay away of #python , but would not surprise me that for compute intensive stuff (where the heavy duty work is done in C/C++), it does not matter (much) which high level language one uses to build data applications submitted by /u/ReplacementSlight413 |
mstdn.science
http://mstdn.science is a place for people our field (microbiology), scientists in general, and science enthusiasts to discuss research and topics surrounding our work.Mastodon hosted on mstdn.science
It's a small patch to Apple's #OpenSource MLX machine learning framework to fix a minor nit that annoyed me, but I was happy to have my first PR accepted against a Python project. (https://github.com/ml-explore/mlx-examples/pull/458#event-11856417623).
Still happily doing #Perl, but #AI is #Python all the way.
Make it easier to know in which file we have bad JSON data by Ovid · Pull Request #458 · ml-explore/mlx-examples
I was using lora.py to train Mistral and accidentally used corrupted JSONL files. My traceback looked like this: Traceback (most recent call last): File "/Users/ovid/projects/llms/mlx-examples/l...GitHub
About half a year ago I wrote myself a little #python script to automate #wikipedia #translation via #deepl.
Tried to use it on my second 💻 today, to no avail and much grinding of teeth.
I'm not setting up any more #venv . I'm fed up. I'm bloody rewriting everything, even libraries in #perl so it works proper on #unix damn it. And maybe throw a look at some #zig porting while at it.
@AFresh1 Yes, because you care about distributing code that others *don’t* need a separate virtual #Perl environment to run.
Nearly every set of end-user installation instructions for #Python-based applications begins with steps to give the app its own virtual environment with separate interpreter and dependencies.
/cc @ology @profoundlynerdy @bololacertus @overeducatedredneck @fuzzix
Direct (non-LinkedIn-shortened) link: https://catonmat.net/ftp/perl1line.txt
I’m also pleased that its author ranked Perl as one of his top 5 best #programming languages: https://catonmat.net/5-best-programming-languages
1. #C / #Clang
2. #PHP
3. #Perl
4. #GoLang
5. #JavaScript (but only version 1 circa 1995 plus #jQuery)
His 5 worst? https://catonmat.net/5-worst-programming-languages
1. #Haskell
2. #Rust / #RustLang
3. #CPlusPlus
4. #Python
5. modern #JavaScript
“My only metric... is time to get things done and ship to customers.”
Top 5 Best Programming Languages
This is the reverse post of my highly popular Top 5 Worst Programming Languages post. My only metric for a good programming language is time to get things done and ship to customers. I don't care about anything else.catonmat.net
For any #Python devs working with Qt who've stumbled on the "Megasolid Idiom" text editor example (https://www.pythonguis.com/examples/python-rich-text-editor/), you might be disappointed that it's written in PyQt5, when PyQt6 is available.
I've ported it to #PyQt 6 for you: https://github.com/Ovid/pyqt6-rich-text-editor
It's still a bit of a hack since I just did a straight port with some minor cleanup. It needs tests. It also needs bars for adjust margins, but despite my searching, I can't figure out how to do that.
Writing a Rich Text Editor in PyQt5
Simple WYSIWYG editor in Python. Megasolid Idiom is a rich text word processor implemented in Python and Qt.Martin Fitzpatrick (Python GUIs)
For anyone working with generative #AI to write software, you might find this bug and subsequent comments on the VS Code Copilot integration interesting.
https://github.com/microsoft/vscode-copilot-release/issues/800
After writing small programs with AI, I decided to see if I could write a large, professional application. It's in a problem domain I know very well, using technologies I don't know (the #python PyQt6 library).
The short verdict: not ready for prime time, but the technology is getting there.
workspace suddenly stopped working · Issue #800 · microsoft/vscode-copilot-release
I've been using @workspace heavily for a Python project. Suddenly, it now longer works and cannot figure out what workspace information to collect. I have tried restarting VS Code a few times, but ...GitHub
How Programming Languages Got Their Names
#haskell #java #kotlin #python #ruby #rust
How Programming Languages Got Their Names - Kyle Higginson - Medium
Have you ever wondered how the likes of Python or Java got their names? Let’s take a look at some programming languages and the story behind how they were named. Before we start — If you’re curious…Kyle Higginson (Medium)
@bololacertus @overeducatedredneck @profoundlynerdy Put another way, `checkbashisms` exists because the only way to get #shell scripters to stick to strict #POSIX syntax and userland programs is to automatically reject deviations with extreme prejudice.
And please don’t get me started on #Python portability. Y’all can’t even settle on how to manage the virtual environments that every individual Python-based tool requires.
@KC1PYT “Recent” is in the eye of the beholder. I haven’t personally used #WebPerl, but it appears to be based on a slight fork of #Perl v5.30 from 2019: https://github.com/Perl/perl5/compare/maint-5.30...haukex:emperl5:emperl_v5.30.0
As with anything, it needs someone with an itch to scratch and enough skills and tuits. The primary author is employed doing #Python now, so it's a fine time to pick it up unimpeded.
Comparing Perl:maint-5.30...haukex:emperl_v5.30.0 · Perl/perl5
🐪 The Perl programming language. Contribute to Perl/perl5 development by creating an account on GitHub.GitHub
Any #Python fans familiar with #PyQt6 ?
I'm stumped. I'm sure I missed something obvious, but I can't tell what it is.
https://stackoverflow.com/questions/77885605/toggling-character-format-with-pyqt6
The other main reason was the availability at the time of MS-SQL DBD driver in #Perl (well it is a Sybase one, but it is perfectly the same).
People who use all that code base today still thank gosh.
Hey, #python devs. I want to be able to enforce that methods overriding existing methods raise an error if they don't have an @override decorator. Likewise, if they have that decorator and don't override a method, it should also throw an exception.
Didn't see anything which does this, so I threw this together. https://gist.github.com/Ovid/1a1d7869b29816cc4c82d00ad42aa2fc
Am I missing something obvious?
Force validation of overridden methods in Python
Force validation of overridden methods in Python. GitHub Gist: instantly share code, notes, and snippets.Gist
@MonkeyPanic I haven't had a chance to try it yet. I've been busy writing an immutable ORM for #Python to better learn the language.
Probably not the easiest project I could try, but I've done it in #Perl 😀