phildini @ the shop · @phildini
2921 followers · 7297 posts · Server wandering.shop

Hey folks (and I'm looking especially at you @treyhunner) what's the most way to “write to file if it exists, else create it and then write to it”?

`open(filename, ‘x’)` only works once, AIUI. I want a code snippet (or library!) that will work every time

#python #pythonic

Last updated 1 year ago

CK's Technology News · @CKsTechNews
1945 followers · 5320 posts · Server cktn.todon.de

Codon - A for High-Performance Applications and DSLs

regmedia.co.uk/2023/03/11/mit_

#compiler #pythonic

Last updated 1 year ago

While working with , I miss being able to use an assignment statement as an expression, particularly when constructing a while loop.

Example:
while ((myDate = NextFOM (myDate)) <= EndDate):
print ("First of Month", myDate)

From what I've read, it looks like a way to rewrite the above code looks like this:

while True:
myDate = NextFOM (myDate)
if myDate > EndDate:
break
print ("First of Month", myDate)

#pythonic #Python

Last updated 2 years ago

While working with , I miss being able to use an assignment statement as an expression, particularly when constructing a while loop.

Example:
while ((myDate = NextFOM (myDate)) <= EndDate):
print ("First of Month", myDate)

From what I've read, it looks like a way to rewrite the above code looks like this:

while True:
myDate = NextFOM (myDate)
if myDate > EndDate:
break
print ("First of Month", myDate)

#pythonic #Python

Last updated 2 years ago

Ciro Spaciari 🚀🐍 · @cirospaciari
16 followers · 40 posts · Server fosstodon.org

This will get even better in 1 or 2 weeks

github.com/cirospaciari/socketify.py

#python #webdevelopment #pythonic

Last updated 2 years ago

Ruth Pozuelo Martinez · @ruthpozuelo
349 followers · 523 posts · Server techhub.social

@spencer @petrem @jzik
It is just not very (readable) so I was just wondering if it was just my background or others find it hard to read too :)

#pythonic

Last updated 2 years ago

· @drts
8 followers · 225 posts · Server fosstodon.org
Ciro Spaciari 🚀🐍 · @cirospaciari
6 followers · 38 posts · Server fosstodon.org

Today we have a lot of new people helping the socketify GitHub project, thank you for all your support!

Is inspiring to see this that means a lot

github.com/cirospaciari/socket

#python #webdevelopment #pythonic

Last updated 2 years ago

Dmitry Z. · @Aqsaqal
5 followers · 6 posts · Server noc.social

My book "Pythonic Programming" is featured and on special sale today (12/20/2022) from 6PM to 11PM EST at pragprog.com/titles/dzpythonic

#dzpythonic #programming #pythonic #python #12daysofpragprog

Last updated 2 years ago

cslinuxboy · @cslinuxboy
41 followers · 36 posts · Server linuxrocks.online

So does not support the basic programming language concept of a constant value. Claiming it's not . Hmm...

#pythonic #python

Last updated 2 years ago

Jos :donor: · @castillar
156 followers · 1494 posts · Server infosec.exchange

OK, fellow devs. I’ve donned my asbestos suit and am ready to open the door to the inferno. 😆 I’m writing a piece for my students (elementary Python class) on writing “Pythonic" code, which might expand into a blog entry at some point. So, with that in mind...

What are some common things that tell you a piece of code is Pythonic?

Could be stylistic, could be functional, anything's good. I'm just looking for tell-tale signs of code vs. code written with an “accent" from another language. (A couple I’ve already scribbled down: list comprehensions, lambda over map/filter…)

#python #pythonic

Last updated 2 years ago

Louis Lang · @louislang
24 followers · 53 posts · Server fosstodon.org
Andrew Scott · @ascott
256 followers · 234 posts · Server fosstodon.org

Just read this article on being for one of my classes
towardsdatascience.com/how-to- It's on medium, so... sorry for the ads and javascript.

Credibility seems to be very important to the author. Unashamedly so, as he is a little smug at certain points.

"If you care about your credibility in the software world and want to proudly call yourself a Python developer, make sure you know and use some of these techniques..."

Dude, I'm just happy when my code actually works.

#pythonic

Last updated 2 years ago

DansLeRuSH ᴱᶰ 🍥 · @danslerush
603 followers · 3790 posts · Server fosstodon.org

« Use your as a : Here's how to log the CPU temperature of a Raspberry Pi and create a spreadsheet-based report on demand » using and thus > opensource.com/article/22/3/ra

#raspberrypi #datalogger #pythonic #python

Last updated 2 years ago

Paolo Melchiorre · @paulox
481 followers · 295 posts · Server fosstodon.org

The video of the talk "Maps with GeoDjango, PostGIS and Leaflet" 🗺️ I presented at 2019 🇪🇺 in Copenhagen 🇩🇰 has almost reached 15000 views. 🚀
I'm very happy and also surprised at the same time.
See you at the next conference. 🐍
youtube.com/watch?v=aEivCtavw-

#djangoconeurope #pythonic

Last updated 4 years ago