linuxgal, to vim
@linuxgal@techhub.social avatar

You can run commands from 𝘪𝘯𝘴𝘪𝘥𝘦

:py3 for i in range(1600,1900):print (f"{i:04d}",chr(i), end=' ')

scottmiller42, to python
@scottmiller42@mstdn.social avatar

It's really a bummer that enumerate doesn't have an option to tell it to go backwards.

Also, it took me way too long to figure out that code like this doesn't do what I wanted it to do. (The index doesn't match the location in MyString.)

MyString = "Hello"
for index , Char in enumerate (MyString[::-1]):
print (index, Char)

0 o
1 l
2 l
3 e
4 H

scottmiller42,
@scottmiller42@mstdn.social avatar

I did find some proposed solutions that involve reversing a generator function and ... bleh. They may be a little more efficient, but none pleased my eye as much as just reversing the range function, like this:

MyString = "Hello"
for index in range (len(MyString)-1, -1, -1):
print (index, MyString[index])

atarifrosch, to random German
@atarifrosch@mastodon.de avatar

Liebe Menschen, die Dinge mit Python3 und Fotos machen: Gibt es einen Trick, die Größe eines Fotos zu ermitteln, das keine EXIF-Daten (oder andere Meta-Daten) hat?

Hintergrund: Ich möchte Fotos, die ich vorher gescannt habe, für einen bestimmten Zweck runterskalieren. Dazu verwende ich meinen downscaler (https://git.atari-frosch.de/?p=downscaler.git;a=tree). Der verläßt sich allerdings auf PIL, ergo auf vorhandene EXIF-Daten. Bei Scans hab ich die natürlich nicht.

downscaler meint, die Dateien seien schon zu klein, aber da muß ich nochmal nachschauen, warum das Fehlen der EXIF-Daten so interpretiert wird.

spla, to random Catalan
@spla@mastodont.cat avatar

He re programat el bot @xmpp de dalt a baix. Ara ja respon en temps real les peticions de registre, estat, info o baixa del registre.

https://codeberg.org/spla/xmppbot.py/commit/e203b92c5a9e0b422611ee0180bd81603feaf6a7

Jo_designart, to random German

Clip "3in1" - Es ist wirklich abgefahren, was mit ein bisschen Code möglich ist. Hier ist er:

from turtle import *
bgcolor("color0")
colorexplosion = ("color1", "color2", "color3", "color4", "color5", "color6", "color7")
for i in range(x):
for gaudy in colorexplosion:
color(gaudy)
circle(xx)
pu()
fd(1 + i)
lt(xx)
pd()

...ein ganz klein bisschen mehr gab's noch ;), aber das " Herzstück" war immer s.o. Der Unterrichtsstil von @piko regt einfach zum Experimentieren an.

Einen schönen entspannten Sonntag.

#python3 #pythonart #codeart #unmask_ai #circles #davinciresolve #pythonkurs

Clip mit drei bunten Kreisschleifenvarianten von immer dem gleichen Basis-Pythoncode (s.Post).

danzin, to python
@danzin@mastodon.social avatar

Shed Skin 0.9.6 released

"I recently decided to sit down and finally port Shed Skin, an experimental restricted-Python-to-C++ compiler in the works since 2005 or so, to Python3. [...]

This does not mean that every Python3 feature is supported [...]. For example, unicode is still restricted to 1-byte characters, and there is no support (yet) for nice new features such as f-strings. [...] subsequent releases should add support for various new #Python3 features."

#python
https://shed-skin.blogspot.com/2023/12/shed-skin-restricted-python-to-c.html

cyclical_obsessive, to RaspberryPi
@cyclical_obsessive@fosstodon.org avatar

MY PERFORMANCE TESTS
Pi5 8GB mounted in official Pi5 case with fan

floating point addition 0.000973ms - 3.5x faster than Pi4

Python3 integer addition 0.000657ms - 3.8x faster than Pi4

Four CPU 100% Stress for 5 minutes: No throttling, 70.3C temp

( containerized) executes 3x faster than Pi4

jane_jordan, to programming

Are there any good books that help a total new person grasp how to program in Python? At least I know in general what the thing I want to program must do. It has to work in NVDA, and it has to read incoming text chats in one window and instantmessages that may appear in other windows. But I really need to just get the hang of the basics first, I am thinking.
What resources do you all recommend? Free online or available via Bookshare or BARD is best, thanks.
.39

nixCraft, to random
@nixCraft@mastodon.social avatar

😂

cymplecy,
@cymplecy@fosstodon.org avatar

@nixCraft Damn and its need for {} :)

twelve_floating_hands, to python

I've been using instead of for scripts lately, but I've been eyeing . Anyone know any lisp dialects that would be as good as for scripting? (Note that I'm sticking to python's standard library for portability)

akuchling, to python

The new release, Python 3.12, is now available: https://www.python.org/downloads/release/python-3120/

spla, to random Catalan
@spla@mastodont.cat avatar

Novetats per a .

  • suport per a afegir i gestionar els usuaris que poden demanar-li coses al bot des de qualsevol sala . ✅
  • ara es poden obtenir i publicar en qualsevol sala xmpp els tuts públics dels usuaris del seguits. ✅
  • recorda les sales, hi torna a entrar després d'un re inici. ✅

https://codeberg.org/spla/poxtit

nekohayo, to python
@nekohayo@mastodon.social avatar

Someone asking if anyone would be interested in porting and maintaining a + app to… 2.x and (indirectly 2.x)… in 2022. Seriously. You can't make this up. 🤦️ https://gitlab.gnome.org/GNOME/meld/-/issues/651

alex_02, to infosec
orowith2os, to programming

#Python folks: Any tips for learning it, coming from #Rust ?

I'm kind of reliant on the strictness of Rust, especially when it comes to using the wrong types and everything. Some way to force me to follow a similar style would be appreciated.

I'm also very reliant on Cargo, it's so clean and integrates everything nicely. I'm not sure if there's an equivalent for Python that matches Cargo.

#hatch also seems interesting for this, I just saw a toot from @airtower that might be useful: https://queer.af/@airtower/110480293814667017

Tips for how to occasionally easily sprinkle in some actual Rust would be nice too.

I will only be developing for #Linux .

#rustlang #cargo #pythonpoetry #python3

dyedbird, to linux

Hello mastadon world! I'm dyedbird. Husband, father and a brother from Maryland. Transitioned to about 1.5 year ago from another career and have been enjoying it so far. Want to learn more about , ,

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • magazineikmin
  • Youngstown
  • osvaldo12
  • khanakhh
  • slotface
  • tacticalgear
  • mdbf
  • InstantRegret
  • kavyap
  • DreamBathrooms
  • thenastyranch
  • everett
  • rosin
  • anitta
  • Durango
  • GTA5RPClips
  • ethstaker
  • modclub
  • cisconetworking
  • ngwrru68w68
  • tester
  • normalnudes
  • cubers
  • Leos
  • megavids
  • provamag3
  • lostlight
  • All magazines