Re: retrieve source code from code object as returned by compile()

2014-04-23 Thread Gregory Ewing
Justin Ezequiel wrote: Using "Easy Python Decompiler" I am able to get the source for the imported modules. Using "Resources Viewer" from PlexData and some code I am able to retrieve the code object. I am however stumped as to how to retrieve the source from this code object. Easy Python Decomp

Re:Moving to an OOP model from an classically imperitive one

2014-04-23 Thread Dave Angel
tim.thel...@gmail.com Wrote in message: > I don't really understand your problem or your examples, but others apparently do. So I'll just make a few comments. > > There is one problem though. Currently, I have these functions logically > organized into source files, each between 40 and 17

Re: how to write list in a file

2014-04-23 Thread Dave Angel
Terry Reedy Wrote in message: > On 4/23/2014 3:53 AM, Dhananjay wrote: >> Hello everyone, >> >> I am trying hard to write a list to a file as follows: >> >> >> def average_ELECT(pwd): >> os.chdir(pwd) > > I would 'print pwd' to make sure where files are being opened. > >> files = filte

Re: App segmentation fault (CentOS 6.5)

2014-04-23 Thread Wesley
在 2014年4月24日星期四UTC+8上午2时08分29秒,Reginaldo写道: > Hi, > > > > I have a GUI app that is written using wx. When I run it on CentOS 6.5, the > following error messages are displayed and the app closes: > > > > (python:10096): Pango-WARNING **: shaping failure, expect ugly output. > shape-engine='B

retrieve source code from code object as returned by compile()

2014-04-23 Thread Justin Ezequiel
Is there a way to get the original source? I am trying to retrieve the main script from a py2exe'd old program. The programmer neglected to commit to SVN before leaving. Using "Easy Python Decompiler" I am able to get the source for the imported modules. Using "Resources Viewer" from PlexData and

Re: Moving to an OOP model from an classically imperitive one

2014-04-23 Thread Gregory Ewing
Ian Kelly wrote: How about adding one abstract class per file, and then letting SubuserProgram inherit from each of those individual classes? I'd recommend against that kind of thing, because it makes the code hard to follow. With module-level functions, you can tell where any given function

Re: Moving to an OOP model from an classically imperitive one

2014-04-23 Thread Gregory Ewing
tim.thel...@gmail.com wrote: I think this would be better solved by moving fully to an OOP model. That is, I would have a SubuserProgram class which had methods such as "install", "describe", "isInstalled"... This wouldn't necessarily be better. Don't be taken in by the "everything is better a

Re: App segmentation fault (CentOS 6.5)

2014-04-23 Thread Terry Reedy
On 4/23/2014 3:46 PM, Mark H Harris wrote: On 4/23/14 1:08 PM, Reginaldo wrote: I have a GUI app that is written using wx. When I run it on CentOS 6.5, the following error messages are displayed and the app closes: Only fails on CentOS ? I use an idle thread in my application. Is

Re: why my cur.executescript can not run?

2014-04-23 Thread Terry Reedy
On 4/23/2014 7:23 AM, length power wrote: please download the attachment Cinfo.zip. Please do not post with attachments. This is a text list, and binary attachments can be a vehicle for malware. Instead, reduce your code to the minimum necessary to exhibit the problem and include it in the p

Re: how to write list in a file

2014-04-23 Thread Terry Reedy
On 4/23/2014 3:53 AM, Dhananjay wrote: Hello everyone, I am trying hard to write a list to a file as follows: def average_ELECT(pwd): os.chdir(pwd) I would 'print pwd' to make sure where files are being opened. files = filter(os.path.isfile, os.listdir('./')) folders = filte

Re: Moving to an OOP model from an classically imperitive one

2014-04-23 Thread Chris Angelico
On Thu, Apr 24, 2014 at 7:42 AM, Ethan Furman wrote: > On 04/23/2014 01:57 PM, tim.thel...@gmail.com wrote: >> >> >> There is one problem though. Currently, I have these functions logically >> organized into source files, each between 40 and 170 LOC. I fear that if >> I were to put all of these

Re: Moving to an OOP model from an classically imperitive one

2014-04-23 Thread MRAB
On 2014-04-23 21:57, tim.thel...@gmail.com wrote: Hello, I am currently writting a program called subuser(subuser.org), which is written as classically imperative code. Subuser is, essentially, a package manager. It installs and updates programs from repositories. I have a set of source files

Re: Moving to an OOP model from an classically imperitive one

2014-04-23 Thread Ethan Furman
On 04/23/2014 01:57 PM, tim.thel...@gmail.com wrote: There is one problem though. Currently, I have these functions logically organized into source files, each between 40 and 170 LOC. I fear that if I were to put all of these functions into one class, than I would have a single, very large s

Re: Moving to an OOP model from an classically imperitive one

2014-04-23 Thread Ian Kelly
On Apr 23, 2014 5:01 PM, wrote: > I asked on IRC and it was sugested that I use multiple classes, however I see no logical way to separate a SubuserProgram object into multiple classes. You say you already have the methods logically separated into files. How about adding one abstract class per fi

Re: Moving to an OOP model from an classically imperitive one

2014-04-23 Thread Mark Lawrence
On 23/04/2014 21:57, tim.thel...@gmail.com wrote: Hello, I am currently writting a program called subuser(subuser.org), which is written as classically imperative code. Subuser is, essentially, a package manager. It installs and updates programs from repositories. I have a set of source fil

Moving to an OOP model from an classically imperitive one

2014-04-23 Thread tim . thelion
Hello, I am currently writting a program called subuser(subuser.org), which is written as classically imperative code. Subuser is, essentially, a package manager. It installs and updates programs from repositories. I have a set of source files https://github.com/subuser-security/subuser/tree

Re: object().__dict__

2014-04-23 Thread CHIN Dihedral
On Wednesday, April 23, 2014 10:21:26 PM UTC+8, Amirouche Boubekki wrote: > 2014-04-23 15:59 GMT+02:00 Phil Connell : > > > > On Wed, Apr 23, 2014 at 03:48:32PM +0200, Amirouche Boubekki wrote: > > > 2014-04-23 8:11 GMT+02:00 Cameron Simpson : > > > > > Look up the "__slots__" dunder var in t

Re: App segmentation fault (CentOS 6.5)

2014-04-23 Thread Mark H Harris
On 4/23/14 1:08 PM, Reginaldo wrote: I have a GUI app that is written using wx. When I run it on CentOS 6.5, the following error messages are displayed and the app closes: Only fails on CentOS ? I use an idle thread in my application. Is your CentOS launching idle with -n switch ?

App segmentation fault (CentOS 6.5)

2014-04-23 Thread Reginaldo
Hi, I have a GUI app that is written using wx. When I run it on CentOS 6.5, the following error messages are displayed and the app closes: (python:10096): Pango-WARNING **: shaping failure, expect ugly output. shape-engine='BasicEngineFc', font='DejaVu Sans 10.9990234375', text='' (python:1009

Re: Unicode in Python

2014-04-23 Thread Rustom Mody
On Wednesday, April 23, 2014 1:23:00 PM UTC+5:30, Steven D'Aprano wrote: > On Tue, 22 Apr 2014 23:57:46 -0700, Rustom Mody wrote: > > On the other hand when/if a keyboard mapping is defined in which the > > characters that are commonly needed are available, it is reasonable to > > expect the ∨,∧ t

Re: object().__dict__

2014-04-23 Thread Phil Connell
On Wed, Apr 23, 2014 at 04:21:26PM +0200, Amirouche Boubekki wrote: > 2014-04-23 15:59 GMT+02:00 Phil Connell : > > > On Wed, Apr 23, 2014 at 03:48:32PM +0200, Amirouche Boubekki wrote: > > > 2014-04-23 8:11 GMT+02:00 Cameron Simpson : > > > > Look up the "__slots__" dunder var in the Python doco

Re: object().__dict__

2014-04-23 Thread Amirouche Boubekki
2014-04-23 15:59 GMT+02:00 Phil Connell : > On Wed, Apr 23, 2014 at 03:48:32PM +0200, Amirouche Boubekki wrote: > > 2014-04-23 8:11 GMT+02:00 Cameron Simpson : > > > Look up the "__slots__" dunder var in the Python doco index: > > > > > > https://docs.python.org/3/glossary.html#term-slots > > >

Re: object().__dict__

2014-04-23 Thread Phil Connell
On Wed, Apr 23, 2014 at 03:48:32PM +0200, Amirouche Boubekki wrote: > 2014-04-23 8:11 GMT+02:00 Cameron Simpson : > > Look up the "__slots__" dunder var in the Python doco index: > > > > https://docs.python.org/3/glossary.html#term-slots > > > > You'll see it as a (rarely used, mostly discouraged

Re: object().__dict__

2014-04-23 Thread Amirouche Boubekki
2014-04-23 8:11 GMT+02:00 Cameron Simpson : > On 23Apr2014 09:39, Pavel Volkov wrote: > >> There are some basics about Python objects I don't understand. >> Consider this snippet: >> >> class X: pass > ... >> >>> x = X() > dir(x) > ['__class__', '__delattr__', '__dict__',

Re: object().__dict_

2014-04-23 Thread Duncan Booth
Pavel Volkov wrote: > There are some basics about Python objects I don't understand. > Consider this snippet: > class X: pass > ... x = X() dir(x) > ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', > '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', >

Re: how to write list in a file

2014-04-23 Thread David Palao
2014-04-23 9:53 GMT+02:00 Dhananjay : > Hello everyone, > > I am trying hard to write a list to a file as follows: > > > def average_ELECT(pwd): > os.chdir(pwd) > files = filter(os.path.isfile, os.listdir('./')) > folders = filter(os.path.isdir, os.listdir('./')) > eelec = 0.0; evdw

Re: Unicode in Python

2014-04-23 Thread Steven D'Aprano
On Tue, 22 Apr 2014 23:57:46 -0700, Rustom Mody wrote: > On the other hand when/if a keyboard mapping is defined in which the > characters that are commonly needed are available, it is reasonable to > expect the ∨,∧ to cost no more than 2 strokes each (ie about as much as > an 'A'; slightly more t

how to write list in a file

2014-04-23 Thread Dhananjay
Hello everyone, I am trying hard to write a list to a file as follows: def average_ELECT(pwd): os.chdir(pwd) files = filter(os.path.isfile, os.listdir('./')) folders = filter(os.path.isdir, os.listdir('./')) eelec = 0.0; evdw = 0.0; EELEC = []; elecutoff = []; g = Gnuplot.Gnu

Re: Unicode in Python

2014-04-23 Thread Steven D'Aprano
On Tue, 22 Apr 2014 23:57:46 -0700, Rustom Mody wrote: > perhaps the following is the most preferred? > > COMPUTE YEAR MODULO 4 EQUALS 0 AND YEAR MODULO 100 NOT EQUAL TO ZERO OR > YEAR MODULO 100 EQUAL to 0 > > IOW COBOL is desirable? If the only choices are COBOL on one hand and the mutant off

Re: Unicode in Python

2014-04-23 Thread Chris Angelico
On Wed, Apr 23, 2014 at 4:57 PM, Rustom Mody wrote: > In such a (default) setup typing a ∧ or ∨ is not possible at all without > something like a char-picker and at best has an ergonomic cost that is an > order of magnitude higher than the 'naturally available' characters. > > On the other hand wh

Re: Unicode in Python

2014-04-23 Thread Rustom Mody
On Wednesday, April 23, 2014 11:22:33 AM UTC+5:30, Steven D'Aprano wrote: > 25 Unicode characters down, 1114000+ to go :-) The question would arise if there was some suggestion to add 1114000(+) characters to the syntactic/lexical definition of python. IOW while its true that unicode is a charac