Skip to main content

Search

Items tagged with: Python


I'm trying to get a full n-quad entry in #Cayley with #python. But all the example queries (in the "Gremlin" API syntax) are restricted to getting a particular set of matching entries. Is there an equivalent of the SQL

```
SELECT * FROM graph WHERE subject = "Foo";
```

Help? 😁


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?

🤔


Using #python to construct and query a "Milvus" vector database of sentence embeddings. This is so cool! 😁


Ok now that I tried building and maintaining my own knowledge graph, I can scrap it, because I am finding https://cayley.io/ to be far superior in like every way. Haha. And sure, there are things like neo4j, but they are also expensive for commercial use. Also, it's been like pulling teeth wrapping my head around it and the #python pyley package. 😅


/me finally makes friends with #django. Years studying #python, but never any django. Got confused / intimidated early on. But now it seems to be making sense. Whew 😁


Wow. There are a couple jr #python jobs out there. My pessimistic self thinks many hiring managers are age discriminators and believe "junior" == "young". We'll see...


That:

a in ('a,' 'b',)

… is legal #Python is very unfortunate.


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! 😁

#FediHire


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.

#Python #wart


"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 #DataViz @python


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.

#python #quantum #math


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)
114 voters. Poll end: 2 months ago


I recommend you add some blocks to your DNS given this Polyfill supply chain hack. Let’s go nextdns! (See https://www.bleepingcomputer.com/news/security/polyfillio-bootcdn-bootcss-staticfile-attack-traced-to-1-operator/ ) #python


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.


Oh! You need a commercial license to conda install numpy if your org has more than 200 employees? #python
"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/


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...

#cursed #bug


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.

#fedihire
#python
#datascience
#webdev


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

#fedihire

https://www.thegravityapp.com/shared/job?clientId=8a7883c6611cbac301611eab8b34377a&id=8a78859f90a311020190b6196a1b72a3&u=1721848018&v=9&token=eyJ1aWQiOjE1MDk4LCJwcm92aWRlciI6ImJvdW5jZSIsInR5cGUiOiJlbWFpbCJ9.1ce4QyH7hY7C9pKXXlmRR0M0wXI


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 ?

https://chrisarg.github.io/Killing-It-with-PERL/2024/07/09/The-Quest-For-Performance-Part-IV-May-the-SIMD-Force-Be-With-You.html


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 ?

https://chrisarg.github.io/Killing-It-with-PERL/2024/07/09/The-Quest-For-Performance-Part-IV-May-the-SIMD-Force-Be-With-You.html

submitted by /u/ReplacementSlight413
[link] [comments]


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.


https://chrisarg.github.io/Killing-It-with-PERL/2024/07/06/The-Quest-For-Performance-Part-I-InlineC-OpenMP-PDL.html

https://chrisarg.github.io/Killing-It-with-PERL/2024/07/07/The-Quest-For-Performance-Part-II-PerlVsPython.md.html

submitted by /u/ReplacementSlight413
[link] [comments]


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.

#Python #stdlib #documentation


Enormous news! the Python Software Foundation now has a 5 year commitment with Fastly to deliver @pypi, us.pycon.org, and much more. We appreciate you and your continued investment in the #python community, Fastly! #PyConUS


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


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

https://wp.me/p5cs3g-4HT


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

#XFS #ZFS #APFS


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.

https://www.reddit.com/r/Astrobiology/comments/1caudbn/can_telescopes_actually_find_biosignatures/l0vzq3e/

#AstroBiology #Science #Astronomy #Life #Software #NASA #SpaceX


Some basic stat computations with Perl , Python and RLessons 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.
Well even in these case, the choice of the generator did matter. Note that the fully vectorized #PDL #perl versions were faster than #rstats

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

https://preview.redd.it/qn00sx78gbuc1.png?width=1538&format=png&auto=webp&s=1874b9e710c239e9acea36fb54d957167a69b270

https://preview.redd.it/4by4jbh9gbuc1.png?width=1538&format=png&auto=webp&s=dc9944347983445126e4ab57b43c76202ca719d6

submitted by /u/ReplacementSlight413
[link] [comments]


Computer Science professor Bob Fulkerson joins the show to discuss his BBS days including his stewardship of the Endless Forest BBS in Omaha. Bob also discusses facets of teaching Computer Science and his love for the Perl programming language.
#bbsing #perl #python

https://sites.libsyn.com/481983/bob-fulkerson-discusses-the-endless-forest-bbs-and-computer-science-academia


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.


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.


#Python : Batteries included

#Perl : Flint and tinder included

#Java : PHB included

#PHP : Notepad included

#C : Screw you

#Rust : Arcane eldritch data guardian forbidding memory blasphemy included.


@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.”


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.


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.

#LLM #Copilot #ChatGPT


How Programming Languages Got Their Names

#haskell #java #kotlin #python #ruby #rust

https://kylehigginson.medium.com/how-programming-languages-got-their-names-df85277de4c3?utm_medium=erik.in&utm_source=mastodon


@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.


@mjgardner Here is the problem: need to deduplicate a massive dataset that cannot fit in memory. #Perl script (on an AMD RYZEN server) about 3.7 sec for 2M rows (1/1000th of the dataset), #Python 3.4 sec, #clang (using the glib hash) about 2.8 sec. Perl actually faster than Python at 1M rows, but the larger the chunk the faster some downstream tasks will run (and the 2M is about the optimal size for this project). The 40% improvement (if verified) kills both C and Python


There is a meltdown in the bioinformatics community about #python now for the same reasons. The stuff I wrote 20+ years ago for my PhD in #Perl & #swig still work (after installing a modern version of PerlMagick)


@jack @nobodyinperson @SReyCoyrehourcq This is the main reason I avoided using #Python for a production code almost 20 years ago.
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?


@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 😀