-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🚀 Feature: use fstring instead str.replace() ? #48
Comments
As you suggested, f strings are not as compatible so it might be better if we use |
So if so, I guess it well be better for write it with future f-string support as follow ?
So in future time it will be easily change to native fstring? As far as I saw fstring faster then string formating. |
Hi, I will like to work on this task. |
I would like to work on this. |
@dan-gut1, let's go with |
I will be delighted, although there is enough work for all of us, if you would like to split the work among us no issue with that. Can you please reference us to the, correct "HOW" to start contribution to code\python SDK repo?, and tests. |
@dan-gut1, best for only one person to work on this. Please refer to:
Please reach out if you're stuck with anything. |
So in the middle way of making the changes, I was asked myself if these changes are worth doing, I made a little test, and its result not so good (at least in me opinion). The test I made as follow with 3 variables.
Here are brief result using timeit.timeitreplace path: 0.5664167 you can find the test code here - https://pastebin.com/FtY1XXcW So it raise a question.Is the changing I'm working on worth doing?, @stnguyen90 let me know what you thinking. |
@dan-gut1 heh...probably not since it's already working 😅 |
Since f-string can be implement for version 3.6 or above instead we can use string concatenation as well, it support all python version and also more faster than all (still not faster than f-string) Edit: Using ''.join we can achieve even more faster than concatenation (We can use it python version 1.6 or above) replace path: 0.49085860000923276 Here is the added string concatenation and join method performance check code in the dan-gut1's code: https://pastebin.com/XRPJpHRi |
@stnguyen90 pinging you, if you missed and want to know your opinion.
|
🔖 Feature description
Why does the SDK uses str.replace() instead fstring?.
🎤 Pitch
In the past few days I'm working on implementing the front of appwrite in python for learning purposes and I've note that the 'python server sdk' mostly uses str.replace() for its calls. increasing processing time on each call of str.replace().
So it raise the question why these calls doesn't uses fstring?, it will greatly reduce processing time.
for example from Services.Databases:
Instead it is possible to use fstring, but need to note that there is lack of compliance with python under version 3.6.
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: