Function factory?

2018-10-24 Thread ftg
Hello everyone, I have 2 functions whose aim is to read a pdf file, the first one manages an uploaded file, the another one fecth a remote one (via an url). They are quite the same: def handle_uploaded_file(path,file): #if os.path.isfile(path + '/' + file.name): #

Re: Function factory?

2018-10-24 Thread Thomas Jollans
On 2018-10-24 10:58, f...@lutix.org wrote: > if check_file(path,file_name): > return True > else: > return False Replace this with a simple return check_file(path, file_name) and now your functions share one line, and one that simply calls another function at that. -

Re: Function factory?

2018-10-24 Thread MRAB
On 2018-10-24 09:58, f...@lutix.org wrote: Hello everyone, I have 2 functions whose aim is to read a pdf file, the first one manages an uploaded file, the another one fecth a remote one (via an url). They are quite the same: def handle_uploaded_file(path,file): #if

Re: Function factory?

2018-10-24 Thread Peter Otten
f...@lutix.org wrote: > Hello everyone, > > I have 2 functions whose aim is to read a pdf file, the first one manages > an uploaded file, the another one fecth a remote one (via an url). They > are quite the same: > > def handle_uploaded_file(path,file): > #if os.path

Building on windows and installing to prefix

2018-10-24 Thread Patrick Stinson
Hello! I am having trouble finding out how to build python from source and then install it to a path prefix, as you can on unix. I have looked at the options in “PCBuild\build.bat -h” and in readme.txt, and on google, but no dice. I have VS 2017. Thanks! -Patrick -- https://mail.python.org/ma

recommends of redesign OO feature of python !!!

2018-10-24 Thread iamybj--- via Python-list
I am an engineer of java and c#, I want to some personal projects in free time, and I choose python. After try python, I hava some suggestion. The first thing is that python’s class is not well designed than other programming languages. Using dictionary as data model is the 20th century style,

Re: recommends of redesign OO feature of python !!!

2018-10-24 Thread Chris Angelico
On Thu, Oct 25, 2018 at 4:16 PM iamybj--- via Python-list wrote: > > I am an engineer of java and c#, I want to some personal projects in free > time, and I choose python. > > After try python, I hava some suggestion. > > The first thing is that python’s class is not well designed than other > p

Re: recommends of redesign OO feature of python !!!

2018-10-24 Thread dieter
iamybj--- via Python-list writes: > I am an engineer of java and c#, I want to some personal projects in free > time, and I choose python. > > After try python, I hava some suggestion. > > The first thing is that python’s class is not well designed than other > programming languages. > Using di

Re : recommends of redesign OO feature of python !!!

2018-10-24 Thread armand.fouca...@telecom-bretagne.eu
If performance is at stake, then Python might not be the best choice. When you pick Python, it's for its other qualities. This being said, unless you're writing software for a plane, you're not very likely to need that much performance... as long as you code well. As for your statem