Tumgik
#better programmer
d0nutzgg · 1 year
Text
Using Cython to Optimize Python Code
Python is a popular and versatile programming language, but it can be slow compared to other languages like C or C++. This is where Cython comes in. Cython is a tool that allows you to write Python-like code, but compiles it to C, resulting in faster performance.
Cython is particularly useful for scientific and numerical computing, where performance is critical. It can be used to optimize existing Python code, or write new code in Cython for improved performance. In this article, we’ll take a look at how to use Cython and why it’s valuable for Python programmers to learn.
Getting started with Cython is easy. You can install it using pip, the Python package manager, by running the following command in your terminal:
Tumblr media
Once you have Cython installed, you can start using it to optimize your Python code. The basic idea is to write your code in Cython, then compile it to C, which can then be imported and used in your Python code.
Here’s a simple example that demonstrates how to use Cython. Let’s say we have a Python function that calculates the sum of squares of numbers in a list:
Tumblr media
We can optimize this function by writing it in Cython, then compiling it to C. Here’s the Cython version:
Tumblr media
In this example, we’ve added a cdef statement to declare the variables as C data types, which results in faster performance. We can then compile this Cython code to C using the following command in our terminal:
Tumblr media
This will generate a .c file that can be imported and used in your Python code.
Cython is a powerful tool that allows you to write Python-like code and optimize it for performance. Whether you’re working on scientific and numerical computing or just looking to improve the performance of your code, Cython is worth learning.
Some great resources for learning Cython include the official documentation, tutorials and example code on the Cython website, and the “Cython: A Guide for Python Programmers” book by Kurt Smith.
Here is the Cython Wiki:
As well as the ReadTheDocs for Cython:
There is also a great tutorial series on using Cython by Pythonist on Youtube
youtube
By using Cython, you can take your Python skills to the next level and achieve faster performance for your code. Give it a try and see the results for yourself!
7 notes · View notes
prostocupoftea · 1 month
Text
Kinitopet Programmers AU
Tumblr media
finally i am finished with this one, daaaamn
it is hard to draw pathetic men with midlife crisis when your style is mostly for anime boys
more info and sketch version under the cut!!
Tumblr media
sketch version aka how it'll probably look like in comic version 'n some doodles
srry for my writing but i was too laisy to put it as regular text
It is a plot-based au, i already have most of the storybits and like... a vibe-chart (i tried to make a playlist for this au and understood that for different chapters and different characters that'd be a copleatly different music, sooo it's a chart now :) )
i will post a fog-o-wared timeline that im hopefully gonna reveal comic-by comic, but also maybe with just pure writing. Hopefully i can include songs that i chose for them into it but we'll see (:
aaand of course designs can change, hopefully not much but we'll see
Now about au:
Main story:
Story follows non-sentient AI Kinito, his creator Sonny and his beta-tester Victoria (oc)
Being literally the first AI (or RRA in-univere) ever, Kinito does not have any, and i mean, any ai safety features so of course his reponce to a goal phrased as "have user near me and/or interacting with me as much as possible" is digitizing them into his own virtual world while killing them in the process. why wouldn't it be?
So that happened. Like, a lot. And with Sonny and Vic too (at the different time but yeah)
Sonny is like "He kills people. We should turn him off because, you know, killing people is bad."
Vic is like "well, we will die if we do that, and it is not that bad here, we are kinda immortal. We should give him acces to changing his initial instalation code before admin priveleges and acces to social media so we can have everythin we want here. It is not that bad to digitize humanity, yk?" and yes i know it is 90, no social media, but shut up, if they made ai then, then i can make twitter then too
Sonny is like "...no??"
And then they fight about it for million chapters
Also they both can't do anything without agreeing bc they have two parts of that admin access key (the data you use to delete kinito in-game) so they are stuck with eachother (also that's why Kinito can't just kill them)
Little facts that may or may not to be important:
Kinito asks so many questions (and weird once too) and has most of the glitches because he needs to analise your responces to copy your mind perfectly (let's pretend that people wouldn't lie about that...)
Your house in your virtual world is made from important places from your memories and oh boy can i do character explorations with this one
I decided that Sonny and Vic are not related. There were thoughts about making then "The Kinito Brothers" (or, at least, siblings) that were mentioned in commercial, but nah, they are just coworkers now. And a bit of work-friends (bc if you interact a lot as a manager of the project and the best worker might as well be friendly)
Author has no idea how small dying toy companies that accidentally create technological marvel work. Author has some idea how AI-s work. So be prepared to be spoon-fed info abut which ai safety problem we are dealing with in which chapter (:
Kinito will mostly be unrendered (as drawn here) but for some cool moments i might pose him as for my other posts. Also his eye placement changes to the side that is most visible because i want him to be able to look to the right side sometimes--
Also when i say "fucked up mentally" i mean they have that them psychological problems with me projecting heavilly B) (guess on who i project most. trick question. all of them. the whole au is my problems split into three characters and forced to interact B) )
Also sea-creature analogies (that are gonna be mentioned like twice):
Victoria is a flying fish because deep character reasons
Sonny is a pufferfish because i said so
oh also there is 7 deaths in the plot as for now
on 3 characters
good luck figuring out who, how and when ((:
for my own sanity i will probably make little doodles where everything is great and kinito is a good guy and not a number-obsessed maniac (i mean... can u imagine not being able to feel any happiness from anything besides one thing... damn...) and you can differenciate them bc good-guy kinito will have a lot of stickers on him (i will explain it somehow but real reason is just bc it is cute af)
like this but even more stickers (he is unfinished here)
Tumblr media
142 notes · View notes
hl-obsessed · 7 months
Text
Tumblr media
click for better quality and all that
135 notes · View notes
dengswei · 2 years
Photo
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
JEFF SATUR blooming night behind
2K notes · View notes
nerves-nebula · 3 months
Text
transgenderism was invented so that I could trade vore art for a custom portfolio website 👍🏾
33 notes · View notes
Text
Begging Tumblr users to finally discover Linux
Everyone keeps complaining about Google and advising to use Firefox etc while still using OS produced by Microsoft which is just like Google maybe worse. Linux is literally free and out there, there are so many different distributions produced in different countries and so much free open source software. Go grab yourself a flashdisk and do yourself a favour. Tbh if you get Ubuntu it is very easy to set up(seriously if you managed to download firefox and add Ublock you probably are very much capable of installing Ubuntu), has shit ton of support online, comes with many useful programs preinstalled and you can even get an add-on to make it look more like windows. Nothing is stopping you
Edit: people are also recommending Linux Mint a lot so you can give that a try! (Personally I have never used it but it looks very windows-like at least when it comes to the UI layout)
41 notes · View notes
williamalex75 · 9 months
Text
Tumblr media
57 notes · View notes
Text
Tumblr media
Do I headcanon that Legend's uncle taught him how to bake the ultimate apple pie? Yes. Yes I do.
————
It's Moving Day: Part 1 and I've spent all afternoon stressed out of my mind. To de-stress, I figured drawing would be a good idea, and since I'd spent the morning reading @sky-squido 's What Hyrule Hadn't Seen (good gods I love Legend's character development in it so very much), Legend was on my mind. Therefore, here! Have a baby Legend, and please treat him well :D
265 notes · View notes
dilfsuzanneyk · 7 months
Text
Tumblr media
happy like a surgeon saturday :D (it's sunday for me, but it's still saturday in most places so!)
30 notes · View notes
yarnings · 2 months
Text
Because why provide actual compassionate social assistance when you can single out the poor kids and game the system to improve only the measured metrics, not the actual situation?
8 notes · View notes
hl-obsessed · 7 months
Text
Tumblr media
colorized version of this with addition of a love bite (@hollandutley tags) 💕
133 notes · View notes
r0semultiverse · 2 months
Text
This is better(?) than the minimalism plague infecting modern web design, but not by much!
Tumblr media
I do not like the mobile appification of web sites either! Looking at you as well, tumblr! By all means, get experimental with it (please do), but don't make everything look & function like a mobile app!
Hey, all supposed 34,175+ followers...
Tumblr media
Can you do me a favor & go @ (or tag) Neal Mohan on twitter & tell him to have the YouTube video page layout changed back? I'm so serious, go bother him about it. If enough people do this & this gets around enough, resulting in more people to asking it be rolled back, it should at least get him to ask it to be changed!
5 notes · View notes
umber-art · 14 days
Text
Hi I'm back again. This time with a quest to figure out how to get the camera to nicely move back to the front of the character when you're not steering it. I wanted to make a few gifs to show my process!
Tumblr media
First figuring out how to actually get the camera to reset in the right direction.
Tumblr media
Getting it to do so smoothly!
Tumblr media
Starting the lerp on a delay, and having it actually update the camera so you can interrupt the lerp any time without it jumping horribly.
Tumblr media
Experimenting with different easing methods so it's snappy but not too snappy, yknow?
Tumblr media
And finally some extra pizzazz, I wanted it to get snappier the longer you're idle for, so you can reasonably control the character from the camera POV without needing to use the camera constantly. Tadah!
BONUS outtakes
Tumblr media
4 notes · View notes
lynchiangf · 5 months
Text
sad bc I'm making my planner for next quarter and just thinking about going back to uni is stressing me out after how awful last quarter was. and there's this course I want to take but I think I have to de-enroll bc I need to keep my workload as low as possible for the sake of my sanity. but that will leave me with just my other 3 mandatory courses that idgaf about :-(
7 notes · View notes
anti-potato · 19 days
Note
Hey pal how you doing
not good, unfortunately
5 notes · View notes
jadedresearcher · 11 months
Note
What made you want to start coding?
How I knew I wanted to make games: A friend let me borrow Chrono Cross and there was this secret ending where you could meet all the devs and they'd brag about all the godlike power they had because they made the game.
How I knew I wanted to make AI adjacent things: Tiny me misunderstood the plot of Terminator and thought they were going back in time to kill Sarah Connor because she MADE skynet and damn if I didn't want that to be me one day.
How I knew I wanted to be a programmer: One of my middle school teachers noticed I would sacrifice anything for a chance at the class computer. She said I should "go into computers" for a job and I was all "you can DO THAT!???"
16 notes · View notes