Skip to main content

Search

Items tagged with: Python


In music - mathematically and in code, what is "swing"?

Over 50%. Compute the relative durations `x`, `y`, and `z`. Then either play both notes of the swing or only the 2nd ("single" in the code) of each beat pattern iteration.

github.com/ology/python-music-…
&
github.com/ology/python-music-…

#Python #Music #Math


I need to extract certain information from a bunch of images. I'm a Python developer, but know little about this niche. Can somebody suggest particular toolkits to start with?

The problem: The placement of flippers on pinball machines has a rich history. There are thousands of different pinball machines. I would like to identify broad trends and turning points. So I'd like to be able to process photos like this in bulk, spot the flippers, and record their locations relative to the rest of the playfield: ipdb.org/showpic.pl?id=20&picn…

I know how to get the raw data (lists of pinball machines, collection of images) but the part I don't know how to tackle is the image processing (selection of best playfield image, compensating for photographer variation, finding the flippers, extracting their position and angle).

If you've done something like this before, what has worked for you? #pinball #python


Hey, any Python experts want to help a Python newbie out? I've been hacking for decades, but I can't say I know Python best practices.

I'm working on github.com/Ovid/sqlitch-v2 (porting some Perl code to Python) and while it seems good to me (but very much alpha and a WIP), I don't know what I don't know. If there's anything obvious I've missed or is unpythonic, I would love to know.

#Python #Perl


Weekend work in progress: #Python #music code that extracts the pitch and beat network transition frequencies of any #MIDI and regurgitates a fresh phrase.

github.com/ology/Music/blob/ma…

Not anything new or earth-shattering, just my take. 😀


Submitted a presentation on musical creativity to 2026.pycascades.com/

Hoping it is accepted! 🤞

#pyCascades2026 #Python


Ok. I've fixed up the #Python #Music arpeggiation and am testing it with github.com/ology/Music/blob/ma…

Here is the transcription of the zany whole-tone wackiness:

1/2


In my ongoing efforts to enhance the python music ecosystem, I have made pypi.org/project/music-basslin… - Adding examples currently... 😀

#Python #Music


Bam! Another in my series of musical creativity #Python classes:

pypi.org/project/music-tonnetz…

Apparently, the nerdiest of chord transformations. Two of the apps on a synth module of mine have Tonnetz things. Ha 😁

This relies on my port of the excellent #Perl module, metacpan.org/dist/Music-NeoRie…


```python
from music_creatingrhythms import Rhythms
from music_drummer import Drummer

r = Rhythms()
beats = 16
kick = ''.join([str(n) for n in r.euclid(2, beats)])
snare = ''.join([str(n) for n in r.rotate_n(4, r.euclid(2, beats))])
hihat = ''.join([str(n) for n in r.euclid(11, beats)])

d = Drummer()
d.set_bpm(100)
d.set_ts()
for _ in range(8):
d.pattern(patterns={ 'kick': kick, 'snare': snare, 'hihat': hihat })
d.sync_parts()
d.show(format='midi')
```

#Python #MIDI Euclidean #drums


New musical #Python package in the house! Today it's pypi.org/project/music-creatin… ported from the c code, that is a companion to the book, abrazol.com/books/rhythm1/ "Creating Rhythms" by Stefan and Richard Hollos.

With it, you can do a bunch of combinatorial things to make rhythmic patterns, like the `euclid(m, n)` method, for instance.

Woo! 😁


I've coded-up a really cool #Python class: pypi.org/project/chord-progres… - It is a network transition, musical chord progression generator. Like a Markov chain thing. 😀

Dig it!


I have created a simple #Python drummer: pypi.org/project/music-drummer…

It is not a "drum machine," but rather the essentials to play drum grooves, instead of a boring metronome. 😀

This is a work-in-progress, and more features may be added yet, like being able to interact with existing music21 scores, for one.


Woo! Woke up and figured out how to clock my synth over my usb audio interface.

gist.github.com/ology/c5e08f35…

Now Metropolix is my servant. Muhuhahaha!

#python #midi


I love Perl. 💜 It's the language I know best, at the moment, because I have been using it since 1995, as a career Perl programmer.

However, I rather like Ruby, because it's very Perlish, has first class PCRE, and is concise and clean, and DWIM. Most importantly, it has a cleaner OOP syntax, with a "class" keyword built-in, unlike Perl, whose OOP is a bolted-on afterthought, bless her dirty soul.

Python is okay, but it's built-in support for List Comprehension is super awesome! List Comprehensions make code even more elegant and pithy than Perl, by natively providing a construct that is roll-your-own in Perl, like OO.

Also, Python's NumPy and SciPy libraries gave it an early lead in the field of Machine Learning, a place that should rightfully have belonged to Perl, notorious for how easily it can slice, dice and munge text.

#perl #ruby #python #programming #programminglanguages #machinelearning


Are you using #Python 3.11 yet? It's been out for two years! Maybe this will entice you: better error messages!


Ok now that I tried building and maintaining my own knowledge graph, I can scrap it, because I am finding 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. 😅


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 github.com/ology for more exciting details! 😁

#FediHire #GetFediHired


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


I recommend you add some blocks to your DNS given this Polyfill supply chain hack. Let’s go nextdns! (See bleepingcomputer.com/news/secu… ) #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: TidBITS.com/2019/06/25/apple-t…

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


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

thegravityapp.com/shared/job?c…


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 ?

chrisarg.github.io/Killing-It-…


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 ?

chrisarg.github.io/Killing-It-…

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.


chrisarg.github.io/Killing-It-…

chrisarg.github.io/Killing-It-…

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": duckduckgo.com/?q=python+get+l… 😬

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 🍔

novelwriter.io/ and github.com/vkbo/novelWriter/bl…

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

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,
blog.koehntopp.info/2023/09/14…

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

reddit.com/r/Astrobiology/comm…

#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 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 metacpan.org/pod/PDL::GSL::CDF & 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

preview.redd.it/qn00sx78gbuc1.…

preview.redd.it/4by4jbh9gbuc1.…

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

sites.libsyn.com/481983/bob-fu…


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. (github.com/ml-explore/mlx-exam…).

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: catonmat.net/ftp/perl1line.txt

I’m also pleased that its author ranked Perl as one of his top 5 best #programming languages: catonmat.net/5-best-programmin…
1. #C / #Clang
2. #PHP
3. #Perl
4. #GoLang
5. #JavaScript (but only version 1 circa 1995 plus #jQuery)

His 5 worst? catonmat.net/5-worst-programmi…
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 (pythonguis.com/examples/python…), you might be disappointed that it's written in PyQt5, when PyQt6 is available.

I've ported it to #PyQt 6 for you: github.com/Ovid/pyqt6-rich-tex…

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.

github.com/microsoft/vscode-co…

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

kylehigginson.medium.com/how-p…