#Python
>「0.1+0.2≠0.3」を説明できないエンジニアがいるらしい #Python - Qiita https://qiita.com/higashi_nc/items/9a5ea00415a008f06843
うーん「0.1 は二進数だと循環小数になるから実は正確に表現できていない」(表示上では切り上げ・切り捨てが行われてそれが見えていないだけ)という単純な説明だと、やっぱり非専門家の人が理解するのは難しいか…
# まぁ、正確には 0.1 == 1.0x10^-1 なので、計算前の単体の値であれば、たぶん浮動小数点型実数で正確に表せたりしてそうなんだけど、これを計算する際、仮数部を補正する際に循環化小数化してしまうとかいう話とかまで言い出すとややこしいからなぁ
Balbix is hiring Senior Software Engineer/Architect - Data Connector
🔧 #cplusplus #java #python #api #aws #azure #gcp #kafka #seniorengineer #solutionsarchitect
🌎 Gurgaon, India; Haryana, India
⏰ Full-time
🏢 Balbix
Job details https://jobsfordevelopers.com/jobs/senior-software-engineer-architect-data-connector-at-balbix-com-aug-4-2020-012721?utm_source=mastodon.world&ref=mastodon.world
#jobalert #jobsearch #hiring
#TIL an interesting #Python "trick". Someone suggested that replacing `sys.stdin` with `open(0)` is shorter & eliminates need to `import sys`.
While that's great for code golf, obfuscated code, etc., it's impractical IRL. E.g.…
• Using `sys.stdin` is much more readable.
• If one isn't careful with `open(0)`, standard input could get closed & difficult (impossible?) to reopen in the same process. (Closing can be avoided by using `closefd=True` with `open()`.)
What are some good tech, #opensource #foss, or other related events and conferences coming in 2024 in North America?
Please reshare for reach 🙏
I'm a little confused as to why it's gotta be
choice = int(input (" > "))
and not
choice = (input (" > "))
for the if statements to work later.
I'm guessing that input always stores user input as a string, even when it's a number, so in order for it to function as an integer, you have to specify that that variable is storing an integer by using int(input()). #python
I was searching for numbers in a string. My method was failing, so I finally decided to look into regular expressions. I couldn't for the life of me figure out why when setting the minimum matching digits to 2, it was also returning numbers of length 1.
Until I noticed I had forgotten to delete my broken code, so it was doing the regex and my thing. Sigh.
https://github.com/Makaze/csschooser
Interactive CLI CSS Chooser for making BeautifulSoup and Scrapy scripts.
CS50P certificate achieved in <1 week! I'm glad I did it; I've needed to make something for quite some time. #Python #CS50 #CS50p #CSS #BeautifulSoup #Scrapy
Gooey: Turn almost any Python command line program into a full GUI application
https://github.com/chriskiehl/Gooey
Discussions: https://discu.eu/q/https://github.com/chriskiehl/Gooey
Today's post in my #Python and #Django "Advent calendar" series: raising awareness of the unittest module's "subtest" feature as a built-in way to do a lot of what pytest's parametrize() does:
https://www.b-list.org/weblog/2023/dec/09/python-unittest-subtest/
Buenas galera!
To fazendo alguns vídeos curtos sobre python para o canal do CodeShow~
Falando um pouco de strings
Youtube: https://www.youtube.com/shorts/Jwx-ugiUNIc
Instagram: https://www.instagram.com/p/C0oxOKVAPBk/
Github: https://github.com/codeshow/one-minute/blob/main/code/one-minute-003.py
Quem tiver sugestão de assunto manda aqui: https://github.com/codeshow/one-minute
Obrigada, paz :heartemo:
I'm several decades familiar with many, many programming languages, but have about a half-dozen that I'd consider *daily driver* languages. #python is not one of them.
I'm writing a lil' thing in #py, and have to keep looking up what modules to include for basic things... and every single time, the answer is exactly what I would have intuited.
"What would I call my datetime module if I were me? I'd call it *datetime*." It's *datetime*.
"If I wanted today's date, I'd want 'date.today()'". Yup.
I guess that's why it's so widely recommended as a starter language. Not starter because it's lacks advanced features, but because it lacks unnecessary confusion!
deep-translator: A flexible, free and unlimited tool to translate between different languages in a simple way using multiple translators.
Currently learning #Python as a long-time #RStats guy. Posting my thoughts as I go along.
Something that blew my mind today was realising that Python, while dynamically typed, _doesn't_ do automatic type coercion!
In the following situation, even though `a` is an int and `b` is a float, `+` doesn't coerce `a` to float, it just knows how to handle float + int (or int + float):
a, b, = 1, 1.5
c = a + b
This is subtle, but it really is a huge difference to R's approach. I actually like it...
Gooey: Turn almost any Python command line program into a full GUI application
Link: https://github.com/chriskiehl/Gooey
Discussion: https://news.ycombinator.com/item?id=38586767

Day 2 of #adventofcode : MUCH easier than day 1. Maybe now I'm just a bit more warmed up with Python and Regex?
Q: How do I learn Django?
A: Skip the books. Django is not something you learn by solving theoretical puzzles. It is a framework meant for solving real needs. The best way to learn it is to concentrate on a small business idea, and jump right into it. Understanding the business and product needs will drive the rest of the process. The more you intertwine Django’s concepts with real world needs, the better.
🆕 🎨 Inspired by https://pep8.org, we've added green and red sidebars to the code examples at https://peps.python.org/pep-0008/ to help illustrate which are recommended and which are not recommended.
For accessibility, we don't rely on colour alone to convey information; as before, the info about whether examples are recommended is included in the text.
https://www.accessguide.io/guide/colorblind
We can add similar borders to help illustrate other PEPs too.


uHTTP: Pythonic web development
https://github.com/0x67757300/uHTTP
Discussions: https://discu.eu/q/https://github.com/0x67757300/uHTTP
C# Dapper has a `QueryMultiple` method, which allows to run multiple SQL statements in a single network round trip. #csharp
https://www.learndapper.com/dapper-query/selecting-multiple-results#dapper-querymultiple
The same can be found with #JS, and from what I can tell, the performance is much better:
But for the life of me, I can not find the same functionality in #Python. I am looking all over asyncpg, or related libraries, and I feel like I am going crazy, because I can not even figure out what part of the Postgres protocol allows for this functionality.
The course Python Programming Bootcamp for Scientists by Gábor Szabó is on sale on Leanpub! Its suggested price is $99.00; get it for $49.50 with this coupon: https://leanpub.com/sh/1uh9NKyn #Python #ComputerProgramming #Software
When teaching #rust, I often see people have a "Wow 🤯!" experience when I show #rustdoc #doctest system: you write small pieces of Rust code in your documentation and they are then executed as part of your test suite.
What people often don't know is that this system is ancient! I first met in #python and there it was introduced in 1999: https://groups.google.com/g/comp.lang.python/c/DfzH5Nrt05E/m/Yyd3s7fPVxwJ. That's 24 years ago!
I don't know if this was the first implementation of this concept?
This year I've been really enjoying #AdventOfCode solution blogs by
@geekyaubergine : https://zoeaubert.me/tags/advent-of-code/ : #Rust #Rustlang
@robb : https://rknight.me/blog/tags/adventofcode/ : #PHP
@lewis : https://lewisdale.dev/post/tag/advent-of-code-2023/ : #Typescript
Eric Burden : https://www.ericburden.work/categories/advent-of-code-2023/ : #Kotlin
@neilnjae : https://work.njae.me.uk/tag/advent-of-code/ : #Haskell
Who else is writing great explanations of their solutions? Help me find new people.
(I write #Python solutions at https://hamatti.org/adventofcode/2023)
Abans i després d'aplicar una mica de #CSS en la pàgina HTML d'inici de sessió en el servidor #Activitypub que estic programant amb #Python.


#HanukkahOfData 5783 Days 4 - 8:
I have just finished #HoD. I did almost everything in SQL with SQL Server.
The ASCII art of the candles and the rug is really beautiful.
https://hanukkah.bluebird.sh/5783/
Here are all my solutions:
https://github.com/nharrer/hanukkah-of

Wow. #AdventOfCode Day 9 was shockingly easy. Day 8 wasn't that hard, either, so I'm worried that Day 10 is going to be a serious ass-kicker.
Day 9 of #AdventOfCode was lovely.
I got a reason to introduce my readers to both itertools.pairwise and collections.deque, both wonderful modules.
I had a pretty epic run of bad rolls and my Pathfinder character was dead 20 minutes into last night's session. Since it isn't hard to role play a corpse, I grabbed my laptop and tinkered with some more of my #CreativeCoding sketches
This time I used the #python library Shapely to help track all of the paths being generated by particles going through the flow field and tried to keep each path from crossing over each other. #py5
Code: https://codeberg.org/TomLarrow/creative-coding-experiments/src/branch/main/x_0100/x_0118




Автоматические бэкапы БД PostgreSQL по расписанию
В этой статье я поделюсь скриптом для создания бэкапов БД PostgreSQL за определенный период (например: 1, 2, 3 дня, 1 неделя, 1 месяц, 6 месяцев, каждый год). Объясню как запустить скрипт с помощью расписания crontab, покажу как настроить синхронизацию папки с бэкапами с облаком Yandex Disk.
Enjoyed today's #AdventOfCode (Day 9). Pretty straightforward overall. Happy with the #python solve as it turned out pretty well. https://github.com/JamesTheBard/advent-of-code/blob/main/2023/09/solution.py
I started writing a blog post (for the @geniepy blog) on how to deploy Reflex.dev applications to Fly.io.
Luckily, I wrote another blog post a few weeks ago on how to run Reflex apps in production, so the one I'm writing right now builds on top of the previous one and saves me quite some work.
Hoping to hit the publish button this weekend! 🤞
Advent of Code Days 8 and 9 — Ghost Story
It took me so long to figure out the Day 8 puzzle that I didn't write it up before bed, so twofer today to catch up.
https://chasingdings.com/2023/12/09/advent-of-code-days-8-and-9-ghost-story/

I think it's amazing how you can get from nothing to a fully parametric #STL of a toy screwdriver in eight lines of #Python code with #sdfCAD.
If I had tried the same in a graphical #CAD software, it'd probably taken me ages. Also, none of the buttery smooth curves the #sdf - based approach makes so easy.
(Code is in the image description.)

#NeuralNetwork #Theb #Python #лытдыбр
Возникла ситуация — из одной нейросетки надо выкачать сгенерированное, но зделоть это можно только по одному файлу, причем отдает она их с одинаковыми именами. Значит, надо следить за папкой и переименовывать с нумерацией.
Питонячий скрипт, написанный чат-ботом, заработал с первого раза, а после 1 небольшой правки — даже сделал то, что требуется.
Чесгря, немного удивлен. (Но Питон всё равно придется выучить, хотя бы на уровне чайника :coffeepot: )
The bundle Level Up by Noah Gift, Alfredo Deza and Matt Harrison is on sale on Leanpub! Its suggested price is $209.95; get it for $85.00 with this coupon: https://leanpub.com/b/levelup/c/LeanpubWeeklySale2023Dec08 #Python #Devops #SoftwareEngineering #NodeJs #Ruby #Go #R
basilisp-lang/basilisp: A Clojure-compatible(-ish) Lisp dialect targeting Python 3.8+
https://github.com/basilisp-lang/basilisp
Discussions: https://discu.eu/q/https://github.com/basilisp-lang/basilisp
Memray: Python memory profiler
https://bloomberg.github.io/memray/index.html
Discussions: https://discu.eu/q/https://bloomberg.github.io/memray/index.html
The bundle All My Current Books by Michael Driscoll is on sale on Leanpub! Its suggested price is $149.94; get it for $86.39 with this coupon: https://leanpub.com/b/allmycurrentbooks/c/LeanpubWeeklySale2023Dec08 #Python #ComputerProgramming #Software
New Awesome Quarto list release!
What's new in #QuartoPub? let's find out!
Release: 2023-12-09
#Quarto #QuartoPub #extensions #templates #Python #RStats #julialang
https://github.com/mcanouil/awesome-quarto#featured-new-releases
Zoox is hiring Senior/Staff Safety Research Engineer - Quantitative Risk Assessment
🔧 #python #seniorengineer
🌎 Foster City, California
⏰ Full-time
🏢 Zoox
Job details https://jobsfordevelopers.com/jobs/senior-staff-safety-research-engineer-quantitative-risk-assessment-at-zoox-com-jan-24-2022-971e53?utm_source=mastodon.world&ref=mastodon.world
#jobalert #jobsearch #hiring
I'm slowly developing a #minimalistic style in Go. This minimal but type-safe style is possible in any language with first-class functions and #generics, though some languages like Python have standard libraries that accommodate this function compositional style out of the box. 🤔
Because it's AoC code error handling is entirely non-existent 😂 Therefore sadly this style will never pass for good production grade Go code. Ah well!
https://github.com/RickWong/go-aoc/blob/main/2023/day09/day09_test.go

If you're a data scientist looking for an IDE to code in, try JetBrains. They have seriously leveled up their game by introducing AI into their IDE.
https://blog.jetbrains.com/blog/2023/12/06/introducing-jetbrains-ai-and-the-in-ide-ai-assistant/
Today Puzzle was a bit easier compared to the previous days. I solved part1 and part2 with the same naive approach.
This year I am NOT coding in #Haskell with #codegolfing, but in #python favoring readability.
I also made a framework, that downloads the puzzle inputs and example inputs, and runs the code on them, so my code is less cluttered.
https://git.k-fortytwo.de/christofsteel/aoc2023/-/blob/main/aoc/day09.py
I just completed "Mirage Maintenance" - Day 9 - Advent of Code 2023 #AdventOfCode https://adventofcode.com/2023/day/9
Stream du samedi lancé 📢
- 12H00 : Lunch code, la pause déj' programmable !
- 14H00 : Stream 3310
Aujourd'hui : on parle iA (entre autre !) puis on passe sur le mooc "Apprendre à coder avec Python"
Le tout de manière simple et ludique 😉
C'est maintenant sur https://www.twitch.tv/formamac 🍎
#stream #streaming #twitch #python #ia #ai #hourofcode @python @pythonhub @chevrierfranckjeannic

Python allows single underscores ("_") to visually separate digits in large numbers, making them easier to read. These underscores are not part of the actual number.

Today's post in my #Python and #Django "Advent calendar" series shows how you can use the HTTPX library to make and test HTTP requests without lots of layers of mock objects and patching (with a hat tip to @hynek for a nice concise explanation of why you shouldn't mock what you don't own):
https://www.b-list.org/weblog/2023/dec/08/mock-python-httpx/
📝 "7 things I learned about GitHub Actions"
👤 Lacey Henschel
🔗 https://www.laceyhenschel.com/blog/2022/11/7/7-things-i-learned-about-github-actions
Due to a stupid mistake I made very early in the project, I had to change a Class name, code file name and all corresponding references and test cases. Boy, what a chore.
Visual Studio Python extension offered to refactor with new Class name but only changed few references, making the task worse 🙁
Anyway I’m done with it and ready to enjoy the weekend with some NBA and NFL. #programming #python
If you want to get started doing Web scraping with Python, this tutorial is very well done.
By Cody Winchester for the NICAR @IRE_NICAR (National Institute for Computer Assisted Reporting - that is, data journalism) conference early this year
https://github.com/cjwinchester/nicar23-python-scraping
I just released #Python 3.11.7 on #deadsnakes, and Anthony Sottile released 3.12.1 and 3.13.0a2.
Yeah, from now on, I'll be helping him get the releases out as part of the regular CPython release process.
https://github.com/deadsnakes/python3.11/actions/runs/7145158923
We had a great recording yesterday with @ericholscher, @charliermarsh, @foosel, @samuelcolvin, @tiangolo, and @willmcgugan on @talkpython. I’m looking forward to sharing the episode with you early next year.
During the stream, one of the listeners said it reminded them of an “Avengers” emergency meeting for #Python Open Source. What do you think:

Back in the late 90s I discovered #python and a few weeks later I had a job writing Python ("Can I use Python?" "Is the code readable?" "Yes"). I saw people post how they wished they could use it for their job.
Now I see people post that they wish they could write Rust professionally. I am over a year in. It did take me a few years of on and off learning as obtaining Rust proficiency can take a little while.
The Rust jobs are out there, but you may have to make them
Is it possible to improve the refactoring in #VSCode?
I was using #Eclipse nearly 20 years ago now and its Java refactoring was FAR superior to what VS Code has.
It might be a Python vs Java thing, but some of it is simple stuff like "extract variable" extracting _all_ instances in scope, or being able to rearrange function arguments.
Is the easiest way to find the location of the smallest nonzero element of a numpy floating point array/matrix really:
- Set all the 'small enough' entries to
np.nan
- Use
np.nanargmin
(context: I am using scipy.spatial.distance.cdist
to generate a distance matrix of all the objects in a simulation, but I want to find the pair of closest different objects and remove that pair from the distance matrix, before iterating)
WOW! You helped us raised more than 2x what we raised last year with the PyCharm discount 🤩 We are so incredibly grateful for you and JetBrains! #python
The promo might be over, but you can still support the PSF in 2023: https://www.python.org/psf/donations/2023-q4-drive/
I just published a new coding project on github!
This is an early exploration of what I call an “epigenetic algorithm.” It’s inspired by an observation: in living cells, the process of evolution is actively managed by the cell, which itself is an evolved mechanism. Using evolution to optimize evolution seems like a powerful trick, so I’m trying to reproduce it in small-scale AI experiments. I hope to make evolutionary computing more open-ended, more successful in vast search spaces, and less biased by the programmer. In this case, I’m generating cool looking Game of Life simulations, but I hope to find many more practical applications in the future.
I hope folks find this interesting, and I’d love to hear your thoughts and feedback!
Presentation: https://docs.google.com/presentation/d/1ZIYj8Rg4xPHukQ-Glk9_IZTgimEYh5dtWsyXrbkX9Dc/edit?usp=sharing
Code: https://github.com/ngaylinn/epigenetic-gol-v1
Results: https://github.com/ngaylinn/epigenetic-gol-v1-results
#ai #evolution #alife #programming #python #cuda #gameoflife #github
@bk1e @tiberiuichim And (I think) it's worth emphasizing that if that is the reason it's taking so long, it's not Poetry's fault, it's because PyPI does not make it easy to bulk-download package metadata to check dependencies. (The situation is probably a little better if it only has to consider newer package versions where there is a separate metadata file, or at least I would hope so)
Finding anything about f-strings docs in docs.python.org is hard (and I say this even as a core dev 🤨)
"F-strings" is like a "common name" that everybody knows now, but...it wasn't its original name.
First, the PEP for it is (PEP 498) is called "Formatted String Interpolation"
Then, CPython officially documents this feature not under "f-strings" heading but as "Formatted String Literal"
😵💫 🤕

RealPython is subscription based, locking things behind a paywall.
As someone who has “spotty” knowledge, ranging from beginner to intermediate, about #python , can anyone recommend a good training course to fill in all the gaps? I’m thinking about building on my knowledge of Python and getting a better understanding of it. #question #askfedi #programming
#Python para quem curte #Processing e #ProgramaçãoCriativa pra quem curte Python.
Dois encontros online, sábado 9/12 e sábado 16/12, entre 10h e 12h da manhã, horário de São Paulo.
Quem sabe você conhece alguém que iria gostar de participar? Quem sabe você não quer oferecer essa atividade como um presente para alguém? Contribuição sugerida de R$100

My #python project uses Poetry for development, but I have a git precommit that generates requirements*.txt files for production and CI. Poetry is great for syncing all your dependencies but you probably don't want to install it on your deployment images.
In today's spooky #AdventOfCode Day 8, my puzzle senses were tingling and that led me to the right direction.
Years of doing these puzzles is finally paying off.
Today's post in my #Python and #Django “Advent calendar" series: using "pip install" as safely and securely as possible (with a hat tip to @brettcannon for being the first person I eve saw explain this stuff concisely).
https://www.b-list.org/weblog/2023/dec/07/pip-install-safely/
PEP 593 is a bit vague on how you’re supposed to actually consume arguments to `Annotated`; here is my proposal.
Dois encontros online,sábados 9 e 16/12, 10h da manhã:
#Python para quem curte #Processing e #Programaçãocriativa pra quem curte Python.
https://form.jotform.com/233352075438658
Last month in Wasm - Python
#python #wasm #componentmodel
Brett Cannon (@brettcannon) from Microsoft has added a build script for building Python for WASI.
https://github.com/python/cpython/blob/main/Tools/wasm/wasi.py
https://github.com/python/cpython/blob/main/Tools/wasm/README.md#wasi-wasm32-wasi
Joel Dice from Fermyon and Peter Huene (@peterhuene) from Fastly have updated Componentize-Py from Wasmtime 13 up to 15 and are planning to be ready for Wasmtime 16 on release.
https://github.com/bytecodealliance/componentize-py/pull/43
https://github.com/bytecodealliance/componentize-py/pull/44
At 20tab we've always been involved in Open Source and we're part of the Python and Django community 🐍
We're working with the Django Software Foundation to improve the UX of its website 🌐
More👇
https://www.20tab.com/about-us/20blog/ux-django-website
Take a few minutes -- today or tomorrow -- to complete the Python Developers Survey 2023 and have a chance to win an amazing prize from JetBrains! 🎁 #python https://survey.alchemer.com/s3/7554174/python-developers-survey-2023
Spent some time with my #Ubuntu 22.04 developing server and its DNS settings. It‘s really weird that there is more than one service which manipulates DNS. I can recommend reading through the man pages of systemd-resolved to understand how it works.
I had to edit the /etc/systemd/resolved.conf and deactivate the DNS stub listener. After that the /etc/resolv.conf won't be overwritten anymore and the netplan configuration works also after a reboot.

Kicking off another @talkpython live stream in a few minutes! Join us and be part of the show with @mkennedy and guests. #python #podcast https://talkpython.fm/stream/live
I thought I might try and buy my many bandcamp purchases using https://github.com/easlice/bandcamp-downloader - but I can't get it to do the cookie thing - instructions don't seem too great - anyone got it working? Basically it should iterate through your purchases and download them in the format of your choice. #python #bandcamp
Over the years of learning and teaching programming, I've modeled card games, especially poker, so many times that day 7 of #AdventOfCode was straight-forward for me.
In terms of Python stuff, today's solution uses classes, inheritance and enums that I haven't yet used this year.
Today Juan Luis Cano Rodríguez from QuantumBlack, AI by McKinsey will give a workshop at PyData Global titled "Who needs ChatGPT? Rock solid AI pipelines with Hugging Face and Kedro" in which attendees will learn how to create a complex AI pipeline using Hugging Face transformers and turn it into a Kedro project that cleanly separates code from configuration and data.
Tune in at 16:00 UTC! https://global2023.pydata.org/cfp/talk/NFZDPN/
#python #pydata #pydataglobal #pydataglobal2023 #kedro #huggingface #aipipelines

In my team we have openings for #developer focused on #offensive / #redteam development. You will help to make the research and education sector better (focused specially for #sweden) with your skills and write all #opensource tools.
https://vr.se/sidfot/arbeta-hos-oss/lediga-jobb.html?rmpage=job&rmjob=441&rmlang=SE #python #sverige #svenska #sunet #infosec
Ask me any question about the position or team and culture.
Please boost for more reach
Latest episode is out!
#441: Python = Syntactic Sugar?
with @brettcannon and @mkennedy #python
https://talkpython.fm/episodes/show/441/python-syntactic-sugar
In this sample chapter from Learn Enough Python to Be Dangerous, you will obtain an introduction to testing in #Python, including a first look at test-driven development, or #TDD. https://www.informit.com/articles/article.aspx?p=3178912
New #meetup event in #Philly cutting across different languages #python #ruby #javascript
Many (but not all) of the quick examples I write when helping people with #Textual go into my sandbox repo; I doubt most are useful past that conversation, some of them likely won't even run any more as they'll have tested bugs or things we've improved. Every so often I tidy the "root" of the repo, moving stuff into the "attic”.
It's getting kinda busy in the attic…

I've finished the last part of my python beginners series that shows how to upload to PyPI using twine. It was a long two weeks but I hope the overall series is useful for beginners looking to put together a fairly modern python project. #python
https://dev.to/cwprogram/publishing-python-packages-to-pypi-with-twine-4h5
Source Markdown available as Creative Commons licensed:
https://github.com/cwgem/devtoarticles/blob/main/2023/10/basic_python/content7.md
I'm also currently open for work: