Sourcery is an INCREDIBLE AI refactoring tool for Python

  Рет қаралды 8,830

Carberra

Carberra

Күн бұрын

Пікірлер: 17
@gardnmi
@gardnmi Жыл бұрын
I now have sourcery correcting copilot suggestions on my editor. Let the AI wars begin!
@desertfish74
@desertfish74 Жыл бұрын
Set lookup is using a hash table which provides O(1) time , finding an element in a tulle or list requires comparing iteratively through all elements and is O(n). So Sets will be much much faster still, for a growing number of elements. However make sure building the set doesn’t take up much of the time …. (If the elements have a difficult to compute hash value)
@ChristophBackhaus
@ChristophBackhaus 4 ай бұрын
I believe that what we are currently doing with code generation is wrong. AI should really be used to refactor software that already exist. So instead of using package managers we should refactor packages into our projects removing all dependencies.
@AMMullan
@AMMullan Жыл бұрын
Really nice tutorial - started using Sourcery a little while ago and it's really really good :) Out of curiosity, can you share your benchmark scripts ?? Interested to know how people are setting up these benchmarks - are you using the timeit like in one of your other tuts ??
@Carberra
@Carberra Жыл бұрын
I don't know if I have the exact scripts anymore, but yeah they're just using timeit. I made a video on it, but that's probably the video you're eluding to 😆
@AMMullan
@AMMullan Жыл бұрын
@@Carberra ah yeah, in the video you actually opened one 🤣 good content mate, definitely going to be checking out more of your work :)
@marcosm5772
@marcosm5772 Жыл бұрын
if check function refactored didn't use bool(x and y), then check(True, 0) would return 0, and check(0, whatever) would return 0. bool makes it either True or False
@hahahap9844
@hahahap9844 Жыл бұрын
they are removing the free plan I think, got email, so now its getting more updates and need to buy the license
@MrKrizzer
@MrKrizzer Жыл бұрын
thats right. I think at this point, I'll just stick with copilot.
@hahahap9844
@hahahap9844 Жыл бұрын
they not removed the free plan@@MrKrizzer
@goparism
@goparism Жыл бұрын
I wouldn't count this as "refactoring" tool, more of a lint/checker. Was hoping this was an actual refactoring tool. Nice overview of tool though.
@Carberra
@Carberra Жыл бұрын
Thanks! To be fair, I've seen it refactor entire functions before, these were just smaller examples. "Refactoring tool" is how Sourcery themselves define it as anyways.
@TheJFMR
@TheJFMR Жыл бұрын
Nice tool, even though I don't legit so much from an AI that change my code, I mean, sometimes I ask to ChatGPT that refactor certain method and If I copy paste the result, it may have bugs or it change a bit my code. So I prefer to go line by line.
@yefritavarez
@yefritavarez Жыл бұрын
Did you just say that writing code which is a bit faster is more important than writing readable code? I mean, from my experience, they are lesser the cases where you would rather speed over readability. Whoever is writing Python code should know that. If you want a more performance runtime, then you should be considering using C, C++ or any other alternatives to this low level languages. And don't get me wrong, I do try my best to write efficient code, but I also try to maintain a balance.
@Carberra
@Carberra Жыл бұрын
I never said anything about sacrificing readability for the sake of speed. I agree with you regarding a balance between the two, but there's no harm in trying to optimise code. Cleaner Python code tends to run faster anyways.
@yefritavarez
@yefritavarez Жыл бұрын
I think this is a great tool, but where is this taking the rules from? I mean, in the Demo class, I'd prefer to have the original class in my code over the suggested one. It's more readable. By the way, you said that you almost see no difference between using a tuple and a set while checking to see if an element in there; try adding a more items... try with 1000 or 10,000 and you see how it drops performance when using the tuple. Because it has to scan almost the whole list, which compared to the set it will follow a linear pattern O ( N )
@Carberra
@Carberra Жыл бұрын
That's...not at all what I said. 7:18 - "You can see that sets are faster when the element does exist, and they are twice as fast when the element doesn't."
Ruff vs. Flake8 vs. Pylint: SPEED TEST
15:26
Carberra
Рет қаралды 3,1 М.
Is Python ACTUALLY faster without the GIL?
13:48
Carberra
Рет қаралды 2,5 М.
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
1% vs 100% #beatbox #tiktok
01:10
BeatboxJCOP
Рет қаралды 67 МЛН
黑天使只对C罗有感觉#short #angel #clown
00:39
Super Beauty team
Рет қаралды 36 МЛН
Deques can be FASTER than lists in Python
12:17
Carberra
Рет қаралды 27 М.
Functools is one of the MOST USEFUL Python modules
13:37
Carberra
Рет қаралды 35 М.
Have you ever used the "column" command in Linux?
8:24
Veronica Explains
Рет қаралды 144 М.
The Ruff formatter is 130x FASTER than Black
15:26
Carberra
Рет қаралды 8 М.
Nox is the ONLY package you'll EVER need
15:55
Carberra
Рет қаралды 3,8 М.
Refactoring Object-Oriented to AWESOME Functional Code
22:59
ArjanCodes
Рет қаралды 52 М.
Python laid waste to my C++!
17:18
Sheafification of G
Рет қаралды 205 М.
The Perfect Dependency - SQLite Case Study
19:32
Tom Delalande
Рет қаралды 93 М.
Replace Is Number Saves 440GB A WEEK
9:54
ThePrimeagenClips
Рет қаралды 398 М.
This VS Code AI Coding Assistant Is A Game Changer!
14:27
codeSTACKr
Рет қаралды 211 М.
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН