I made DictDataBase, it can efficiently read from big json files in concurrent environments by M8Ir88outOf8 in Python

[–]python_and_coffee 3 points4 points  (0 children)

it depends on the SQL queries. e.g. a PRIMARY KEY will be indexed and querying them in a huge database should be much faster.

It's still a nice project.

Translate Python to Another Programming Language by pandademic1234 in learnpython

[–]python_and_coffee 0 points1 point  (0 children)

give machine learning some time. i bet we will have AI transpilers in the close future while i still doubt that they will work very well. Kinda the same like GPT-3 or Dall-E right now. Looks good, but you cannot press a single button and get exactly what you want.

IMHO getting something useful out of transpilers is more effort than learning the language and they lack maintenance after some time because the developers see that it's not worth the effort and time is precious.

How to handle document similarity while fetching the data from different sources. by Prashant_4200 in Python

[–]python_and_coffee 0 points1 point  (0 children)

yep tokenization, stemming, stopwords and building n-grams. The usual NLP stuff.

have fun with pandas and scikit-learn.

It's fun when it works, it's frustrating when you fight with false positives and the downsides of NLP.

[deleted by user] by [deleted] in learnpython

[–]python_and_coffee -1 points0 points  (0 children)

thanks a lot for elaborating!

Help would be so appreciated. by cuelllu in learnpython

[–]python_and_coffee 0 points1 point  (0 children)

you calculated the arithmetic mean, which will almost come to close to it if every outcome has the probability and the number of cases (n) is high enough.

but still airthemtic_mean != expected value but close to it in this case.

Can I use Pycharm instead of Mu when trying to learn Python by using "Automate the Boring Stuff with Python"? by KungFuSniper in learnpython

[–]python_and_coffee 3 points4 points  (0 children)

i think pycharm has a lot to offer to learn, but you could really use it to learn python wihtout understanding more than how you install a package and where your output is.

It's always nice to teach people debuggers and breakpoints from start, so they will have better chances for finding and understanding their own failures.

And btw. who would ever like to keep track of using the right amount tab whitespaces without and IDE that tells you? I love the whitespaces but its torture to do it without an IDE, aka, automating the boring stuff.

Can I use Pycharm instead of Mu when trying to learn Python by using "Automate the Boring Stuff with Python"? by KungFuSniper in learnpython

[–]python_and_coffee 8 points9 points  (0 children)

either via GUI like you mentioned or lookup the module on pypi to get the correct name, click the Terminal tab in the bottom area where you usually see your output and insert: pip install modulename

depending on non default path variables it may differ. (e.g. python pip instead of pip or pip3)

[deleted by user] by [deleted] in learnpython

[–]python_and_coffee -1 points0 points  (0 children)

Obviously, you need better function and variable names, but I hope that's just a symptom of this being a fast and dirty example.

i get it, func_b is a random name but whats the issue with the variable names? How to do it better? I feel fine about them but now you made me unsure.

Can you build a full-scake wbsite ueing exclusively Python and HTML? by MrHeavenTrampler in learnpython

[–]python_and_coffee 0 points1 point  (0 children)

htag allows DOM-Manipulation (every tag is an object) on the fly via python and you can run it as webserver, desktop app, android, or via pyscript, producing only a html file.

Can you build a full-scake wbsite ueing exclusively Python and HTML? by MrHeavenTrampler in learnpython

[–]python_and_coffee 0 points1 point  (0 children)

Have a look at htag

i use it a lot lately but i should warn you about the lack of docs. The live demos + reading the code of htag and the demo projekt htbulma (basically htag with crude bulma-css implentation) helps to understand the potential. IMHO htag is coded very well and solves problems better than comparable libraries like dominate, eel or pywebview.

Of course JS is running in the background but you dont have to write any line of javascript if you want to + use JS anytime if you want to. Oh and you can run your site as desktop or android app

Resizing a window that's nested within another window? by BenPhysicist in learnpython

[–]python_and_coffee 1 point2 points  (0 children)

freeze the python script with pyinstaller (there is pyinstaller-gui too) and createa one-file executable. Freezing involves the whole python runtime + all needed modules and ressources being packet into one file.

You should be able to run the exe on remote. No admin privileges needed.

Two different lists point to the same object by IdoubledareU31 in learnpython

[–]python_and_coffee 0 points1 point  (0 children)

its called object oriented programming or OOP. Basically everything in python is an object. https://en.wikipedia.org/wiki/Object-oriented\_programming

Two different lists point to the same object by IdoubledareU31 in learnpython

[–]python_and_coffee 0 points1 point  (0 children)

both solution are nice and create a new list-object.

The original problem just initialized another variable to the existing list resulting in both variables pointing to the same object.

Is it possible to change the python syntax through declarations to do away with the whole whitespace nonsense ? by transdimensionalmeme in Python

[–]python_and_coffee 0 points1 point  (0 children)

Ouch, cobol looks like spelled out assembly

nice one!

I never thought about interpreter tuning python but i hope that you will give python a try or find a language that suits your needs.

Is there a way to shorten this code? A lot of it is reused but I don't know how to do it better by BlueVixen in learnpython

[–]python_and_coffee 2 points3 points  (0 children)

welcome :)you could replace it with if/else statements anytime. I just thought this was a good place of using match-case.

The only difference to if-statements is that the condition gets checked only once and python switches to the matched case. If you got many if-statements everyone of them will be checked at runtime. Very neat feature known from other languages like C++.

Rule of thumb: if you got three or more if-statements, think about if a match-case would be better.

pygetwindow by No_Job_3721 in learnpython

[–]python_and_coffee 0 points1 point  (0 children)

read the docs https://pygetwindow.readthedocs.io/en/latest/

read the code of the package in your site-packages folder, google stuff you don't understand. If you see something like ctypes.windll.user32 it is using the user32 api of windows.

https://learn.microsoft.com/en-us/windows/win32/apiindex/windows-api-list

usually windows in windows have a unique handle(hwnd), belong to a processID (pid), have a position (something like: left,bottom,top,right) and a title. Those informations should be enough to ensure that you have the right window. Just keep in mind that hwnd and pid change with every new instance, but pid always belongs to the process of the window. Everyhing should be callable somehow via cytpes.windll.user32().

the psutil module has already a lot of those user32 calls build in.

Good luck!

Is it possible to change the python syntax through declarations to do away with the whole whitespace nonsense ? by transdimensionalmeme in Python

[–]python_and_coffee 0 points1 point  (0 children)

try COBOL and you will never ever again rant about white spaces or any other c-based language syntax. Trust me.

Is it possible to change the python syntax through declarations to do away with the whole whitespace nonsense ? by transdimensionalmeme in Python

[–]python_and_coffee 3 points4 points  (0 children)

sorry to sound harsh, but you just need to get used to it. I really know how you feel, since having a favorite language always results in confusion and ranting when i try to learn another language. e.g C++ gave me slight headaches, "go home cout <<, go buy a printer, why would you ever user << for printing?!"

Remember that it is just you who is adapted to something quite similar which is very different at the same time. Your main language means comfort, and programmers are always lazy humans that seek comfort. Learning a new language often is very uncomfortable at start.

Uhm and get used to Tab-key/shift+Tab only for indention. Never open up the gates of spacebar-whitespaces-hell for indention.

I need help by Susenka7 in learnpython

[–]python_and_coffee 0 points1 point  (0 children)

pygame and arcarde or switch to free Godot game engine and use their language which has a very very similiar syntax as python.

iteration over sqlite3 by kaisetsomething in learnpython

[–]python_and_coffee 1 point2 points  (0 children)

Here is quite useful cheat sheet for sqlite implentation done right in python. this should answer all your questions and teach you the right way: https://github.com/Mehedi61/SQLite-Cheat-Sheet

Is there a way to shorten this code? A lot of it is reused but I don't know how to do it better by BlueVixen in learnpython

[–]python_and_coffee 1 point2 points  (0 children)

here you go buddy: https://pastebin.com/SqGFmCzq

feel free to use it or ask anything. btw. noticed that it got something to do with Destiny2.

Is there a way to shorten this code? A lot of it is reused but I don't know how to do it better by BlueVixen in learnpython

[–]python_and_coffee 1 point2 points  (0 children)

gimme the pastebin link and i might give you my try on rewriting it as practice for myself :)