Creating type evaluation annotation
I'm Java developer,but had some experience with Python based ERP software. It is quite serious application and I feel unconfortable with not having type checking. I do not say language should be static, but having checking method signature is big win. For example in refactoring. I know that Python 3 has possibility to have indicate type for varibale or param What could be great to have possibility to annotate any class with what I call "type evaluator" function. That could check method signature with rules specific for given type. The simplest evaluator would simply check if signature is same as method definition. But it could go futher. It could check whatever is valid logic for creating methods in given class and whatever are valid params for given method. Even more powerful evaluator could be not only valid/not valid indicator. It could validate and suggest next param or method part name for given written part of call. That could make python IDEs much more powerful From my experience having signature checking and hinting params when writing code is really big win. I could simply refactor 10 lines of code in Java, but same for Python is much more difficult Best regards, Marek Mosiewicz -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating type evaluation annotation
I'm talking about this https://docs.python.org/3/library/typing.html I'm not talking about new language. I think it could be nice to have standard PEP annotations for classes to make type validation or type hints when writing code. It would be best of two worlds. Dynamic language with optional type chceking if somebody wants it. In Groovy language there is annotation to indicate that you can not make calls to methods which do not exist. It could go futher and you could have annotation which validates whatever method signature if it is valid. For example you can have valiadator for something like Ruby on Rails in Ruby language for methods which starts with find: invoice.find_by_name invoice.find_by_name_and_description It could be even better and give you type hints when you type method name. In this example when you write in IDE: invoice.find_by_ it would suggest you futher possible method parts and possible parameters for method. This class valiadtors would be optional and run only when developer wants to validate or write code, not in production as it is heavy. W dniu 06.12.2018, czw o godzinie 20∶06 +, użytkownik Jon Ribbens napisał: > On 2018-12-06, Marek Mosiewicz wrote: > > I'm Java developer,but had some experience with Python based > > ERP software. It is quite serious application and I feel > > unconfortable with not having type checking. I do not say language > > should be static, but having checking method signature > > is big win. For example in refactoring. > > I know that Python 3 has possibility to have indicate > > type for varibale or param > > Are you talking about http://www.mypy-lang.org/ ? -- https://mail.python.org/mailman/listinfo/python-list
Re: Creating type evaluation annotation
W dniu 09.12.2018, nie o godzinie 15∶50 -0500, użytkownik Terry Reedy napisał: > > Mypy recognizes this sublanguage to 'compute' whether calls conform > to > the defined interfaces. > As far as I understand currently it computes if declaration commits to static type. What I propose is to annotate type with "duck" typing checker and futher it could make suggester for duck typing. We can imagine duck typing suggester for imaginary entity class which accepts finders like in Ruby on rails : "find_by_name" "find_by_id" "find_by_name_and_something" Then when you type "find_" it will suggest futher method name. When you finish typing "find_by_name_and_length" for example it will force you to put two paramters of type string and int > > -- > Terry Jan Reedy > -- https://mail.python.org/mailman/listinfo/python-list
Re: More CPUs doen't equal more speed
Do you do it as separate process or thread. There is https://wiki.python.org/moin/GlobalInterpreterLock so you need to spawn many processes Best regards, Marek Mosiewicz http://marekmosiewicz.pl W dniu 23.05.2019 o 20:39, Bob van der Poel pisze: I've got a short script that loops though a number of files and processes them one at a time. I had a bit of time today and figured I'd rewrite the script to process the files 4 at a time by using 4 different instances of python. My basic loop is: for i in range(0, len(filelist), CPU_COUNT): for z in range(i, i+CPU_COUNT): doit( filelist[z]) With the function doit() calling up the program to do the lifting. Setting CPU_COUNT to 1 or 5 (I have 6 cores) makes no difference in total speed. I'm processing about 1200 files and my total duration is around 2 minutes. No matter how many cores I use the total is within a 5 second range. This is not a big deal ... but I really thought that throwing more processors at a problem was a wonderful thing :) I figure that the cost of loading the python libraries and my source file and writing it out are pretty much i/o bound, but that is just a guess. Maybe I need to set my sights on bigger, slower programs to see a difference :) -- https://mail.python.org/mailman/listinfo/python-list
Blasphemy
What about, if Python would have optional end keyword. In fact most of blocks have starting : sign. What if you would have also keyword to optionaly mark end of block. That would be big win for IDEs to format code and ensure that there is no problems with intendation. There could be some keyword to mark script as strictly marking blocks and then it would have this kind of validation. Cheers, Marek Mosiewicz -- https://mail.python.org/mailman/listinfo/python-list
Re: Calculator
Considering just basic calculator with eval it could be possible search eval string if it only contains digits, parenthensis and operators. Assuring no letter (maybe except e for expotential) and special characters this calculator should be quite safe. But I give no any warranty for such security. Cheers, Marek Mosiewicz W dniu śro, 15.01.2020 o godzinie 18∶09 +0100, użytkownik Python napisał: > Le 15/01/2020 à 16:34, andersh...@gmail.com a écrit : > > Thanks! > > Do not try it, though, with a expression such as > import os; os.system('rm -rf ~/*'). > > > -- https://mail.python.org/mailman/listinfo/python-list
Any experience with Python for GraalVM ?
Hello, Does somebody have any experience with GraalVM [1] It is new VM from Oracle which is said to have ability to run Python 3 I have idea to try to run Odoo [2] on it [3]. Odoo is ERP system written in Python. Odoo is big piece of software with many dependencies, but from my understanding of it most important to have something working on Graal would by werkzung and have some working implementation of psycopg2 (Postgresql API) Any ideas ? [1] http://www.graal.org [2] http://odoo.com [2] https://github.com/marekmosiewicz/goblet Marek Mosiewicz http://marekmosiewicz.pl -- https://mail.python.org/mailman/listinfo/python-list
Re: Any experience with Python for GraalVM ?
W dniu czw, 05.11.2020 o godzinie 11∶02 -0500, użytkownik Dennis Lee Bieber napisał: > On Thu, 05 Nov 2020 11:10:03 +0100, Marek Mosiewicz > declaimed the following: > > > Does somebody have any experience with GraalVM [1] > > It is new VM from Oracle which is said to have > > ability to run Python 3 > > > Based upon https://www.graalvm.org/reference- > manual/python/ that > capability is rather minimum... I just downloaded GraalVM and Werkzeug is being installed successfully. Maybe it is worth to try. > > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.com > http://wlfraed.microdiversity.freeddns.org/ > -- Marek Mosiewicz http://marekmosiewicz.pl -- https://mail.python.org/mailman/listinfo/python-list