Re: FDs will be closed after exception automatically in python2.7?

2019-06-10 Thread D'Arcy Cain
On 2019-06-10 15:46, Alan Bawden wrote: > D'Arcy Cain writes: >> with open("file","w+") as fd: > > That makes the window smaller, but it doesn't actually eliminate it. Look > at the generated byte code. In both cases the call to open() is over and > the open file is created _before_ the SETUP_W

Re: FDs will be closed after exception automatically in python2.7?

2019-06-10 Thread Alan Bawden
D'Arcy Cain writes: > On 2019-06-10 10:48, Michael Torrie wrote: > > fd = open("file","w+") > > with fd: > > There is still a small window there if there are asynchronous events > happening. Use this instead: > > with open("file","w+") as fd: That makes the window smaller, but it doesn't actua

can not use pycharm

2019-06-10 Thread aris
Hello,this is my first time trying to learn coding and programming and I wanted to start with python.Though,when I download pycharm, I go to configure>settings>project interpreter and i can not put a project interpreter( I have download python version 3) .What should I do?thank you for your ti

Re: FDs will be closed after exception automatically in python2.7?

2019-06-10 Thread D'Arcy Cain
On 2019-06-10 10:48, Michael Torrie wrote: > Probably you should be using Python 3, which uses a print() function. > But even in Python 2.7, the recommended way to do this is like this: > > fd = open("file","w+") > with fd: There is still a small window there if there are asynchronous events happ

Re: FDs will be closed after exception automatically in python2.7?

2019-06-10 Thread Michael Torrie
On 06/10/2019 04:18 AM, lampahome wrote: > as title, > > I confused will fd will be close after exception automatically? > Like: > try: > fd=open("file","w+") > fd.get() //any useless function of fd > except Exception: > print 'hi' No. What if you want to work with the fd object afte

Re: FDs will be closed after exception automatically in python2.7?

2019-06-10 Thread Cameron Simpson
On 10Jun2019 12:47, Peter J. Holzer wrote: On 2019-06-10 18:18:07 +0800, lampahome wrote: I confused will fd will be close after exception automatically? Like: try: fd=open("file","w+") fd.get() //any useless function of fd except Exception: print 'hi' Please try to preserve indentation when

Re: FDs will be closed after exception automatically in python2.7?

2019-06-10 Thread Peter J. Holzer
On 2019-06-10 18:18:07 +0800, lampahome wrote: > as title, > > I confused will fd will be close after exception automatically? > > Like: > try: > fd=open("file","w+") > fd.get() //any useless function of fd > except Exception: > print 'hi' Please try to preserve indentation when sending code to

FDs will be closed after exception automatically in python2.7?

2019-06-10 Thread lampahome
as title, I confused will fd will be close after exception automatically? Like: try: fd=open("file","w+") fd.get() //any useless function of fd except Exception: print 'hi' -- https://mail.python.org/mailman/listinfo/python-list