`exec`-based routine crashes app upon migration from 3.4.3 to python 3.5.2.
I've manually set breakpoints and traced this app crash back to this function: def loadLSobjsOfType(self, objType, listJ): if listJ != None: for objJ in listJ: _locals = locals() exec('obj = ' + objType + '(self)', None, _locals) obj = _locals['obj'] obj.loadJson(objJ) self.addLSobjOfType(objType, obj) when breakpoints are set on `obj=_locals['obj']` my wingware debugger kicks in and throws a KeyError exeption. So what's the proper way to get the return value of an exec call when there is one? Thanks. Regards, EM -- https://mail.python.org/mailman/listinfo/python-list
Re: Thoughts on python classes to represent an ebook reader
Thanks a lot. It is quite helpful to follow the thought process here. Another person gave the example of 'Calibre', but I've found it overwhelming and I couldn't find any UML diagram there (maybe not searched hard enough). Regards, Felix -- https://mail.python.org/mailman/listinfo/python-list
Re: how to parse standard algebraic notation
Thanks a lot, I will give this a shot. -- https://mail.python.org/mailman/listinfo/python-list
Thoughts on python classes to represent an ebook reader
Hi, I hope there are people here with strong OOP experience. Which classes would an object-oriented python programmer create for the design of a e-book reader for example? I am not really interested in the code, just the OOP classes that would come to one's mind for a task like this. It should allow users to buy new e-books, view their list of purchased books and read the books. I have made an attempt of class diagram here "http://imgur.com/9TR2Tlm"; but I would be really glad to hear other opinions. I have not used any inheritance for example. I didn't know exactly where it would be handy and I also dont know if these classes are theoretically a good basis at all... Thanks a lot for comments/feedback. Felix -- https://mail.python.org/mailman/listinfo/python-list
Re: how to parse standard algebraic notation
On Tuesday, 30 September 2014 23:15:24 UTC+2, Gary Herron wrote: > On 09/30/2014 01:53 PM, math math wrote: > > > Hi, > > > > > > I am trying to learn Python while solving exercises. > > > > > > I want to basically write a program that inputs a polynomial in standard > > algebraic notation and outputs its derivative. > > > > > > I know that I need to get the exponent somehow, but I am not sure how to > > accomplish this in python (3.3) > > > > > > Do you have any ideas or suggestions? I don't want to use existing modules > > as this is meant to be a didactic experience. > > > > > > Regards > > > > This depends on things you have not yet told us. > > > > In particular -- what "standard algebraic notation"? For x-squared: > > x**2 ? or perhaps x^2 ? or something else like some Unicode > > characters or HTML to get a small superscript 2 above an x. > > > > Once you give an example of what your input looks like, we can start > > hashing out how to read it. > > > > Gary Herron > > > > -- > > Dr. Gary Herron > > Department of Computer Science > > DigiPen Institute of Technology > > (425) 895-4418 Thanks Gary (and Chris), I should have sent a sample expression indeed. What would be a good starting strategy for writing a program to take the derivative of a polynomial expression, such as this below?: "x**3 + x**2 + x + 1" I am a bit confused about my overall strategy. Should one be writing a parser class to split the input on operators and then on the double asterisks? Are there more clever ways? Or is this something one should solve using mathematical formulas instead of parsing the characters? I just wonder how a seasoned Pythonian would go about a problem like this without using a ready-made derivative function from some module. Regards, Felix -- https://mail.python.org/mailman/listinfo/python-list
how to parse standard algebraic notation
Hi, I am trying to learn Python while solving exercises. I want to basically write a program that inputs a polynomial in standard algebraic notation and outputs its derivative. I know that I need to get the exponent somehow, but I am not sure how to accomplish this in python (3.3) Do you have any ideas or suggestions? I don't want to use existing modules as this is meant to be a didactic experience. Regards -- https://mail.python.org/mailman/listinfo/python-list
Re: Registration Code
P..Philippe.. Where can I find some sample code if any? And I'm not a professional programmer... This is going to be hard...and my native is Dutch.. Thanks anyway Hi, A suggestion: I would use encryption (ex: AES): Hide a secret key in your code and generate an encrypted (readable: ex 07 7B 6F ) version of the correct info (such as full release, or demo expire in ...) with that very same key. Have your software input that encrypted info (some GUI dialog box), decypher the info then act accordingly. The trick is: where to store that ? I would use some binary data file (encrypted bziped pickle ?) with a hash or CRC built in to prevent obvious tampering. Hope that helps, Philippe Math wrote: > Hello, > > I wonder if I can ask this particular question here... > I'm writing this piece of Python Software and I'm almost done...:-) > But now I want the end-user to register this software with a registration > code or perhaps something like an evaluation demo version which expires > after some period of time... > Is this the right place to ask or does anybody know where to look for more > on the subject? > > Thanks -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Registration Code
[EMAIL PROTECTED] OKAY Sybren.. How does one get the job done? -- > Math enlightened us with: >> But now I want the end-user to register this software with a >> registration code or perhaps something like an evaluation demo >> version which expires after some period of time... > > Fair enough. What do you want to know from us? > >> Is this the right place to ask or does anybody know where to look >> for more on the subject? > > You never asked anything ;-) > > Sybren > -- > The problem with the world is stupidity. Not saying there should be a > capital punishment for stupidity, but why don't we just take the > safety labels off of everything and let the problem solve itself? > Frank Zappa > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Registration Code
Hello, I wonder if I can ask this particular question here... I'm writing this piece of Python Software and I'm almost done...:-) But now I want the end-user to register this software with a registration code or perhaps something like an evaluation demo version which expires after some period of time... Is this the right place to ask or does anybody know where to look for more on the subject? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: 1.090516455488E9 / 1000000.000 ???
Thanks this does the job And yes, I really need this accuracy.. Many Thanks - Original Message - From: "Felipe Almeida Lessa" <[EMAIL PROTECTED]> To: "Fredrik Lundh" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, March 28, 2006 6:00 PM Subject: Re: 1.090516455488E9 / 100.000 ??? > Em Ter, 2006-03-28 às 16:59 +0200, Fredrik Lundh escreveu: >> and consider using >> >> http://www.python.org/doc/lib/module-decimal.html >> >> instead. > > $ python2.4 > Python 2.4.2 (#2, Nov 20 2005, 17:04:48) > [GCC 4.0.3 2005 (prerelease) (Debian 4.0.2-4)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. from decimal import Decimal a = Decimal("1.090516455488E15") a > Decimal("1.090516455488E+15") b = a / 100 b > Decimal("1090516455.488") str(b) > '1090516455.488' > > *But*, > > $ python2.4 -mtimeit -s 'from decimal import Decimal; a = > Decimal("1.090516455488E15")' 'a/100' > 1000 loops, best of 3: 222 usec per loop > $ python2.4 -mtimeit -s 'a=1.090516455488E15' 'a/100' 100 loops, > best of 3: 0.234 usec per loop > $ calc 222/0.234 >~948.71794871794871794872 > > Decimal is almost one thousand times slower. Do you really need this > accuracy? > > HTH, > > -- > Felipe. > > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: 1.090516455488E9 / 1000000.000 ???
Should be 1.090516455488E15 - Original Message - From: "Math" <[EMAIL PROTECTED]> To: Sent: Tuesday, March 28, 2006 4:29 PM Subject: 1.090516455488E9 / 100.000 ??? > Hello, > > I got a simple and probably stupid newby question.. > When I compute: > 1.090516455488E9 / 100 > the result is 1090516455.49 > Should be 1090516455.488 > > I know something with float and //... > > Anybody? > How do I get correct number? > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
1.090516455488E9 / 1000000.000 ???
Hello, I got a simple and probably stupid newby question.. When I compute: 1.090516455488E9 / 100 the result is 1090516455.49 Should be 1090516455.488 I know something with float and //... Anybody? How do I get correct number? -- http://mail.python.org/mailman/listinfo/python-list
Re: Converting Time question
Me again.. I guess I ask it wrong.. I measure a time at racing events.this tracktime is measures in the format hh:mm:ssDDD where DDD = thousands of a second...like 17:14:11.769 This format is being saved as a number of micro seconds since 1970.. like 1,090516451769E+15 How do I convert from the micros seconds back to time format above? thanks again Hope someone can help me out.. > Hello PythonPeople.. > > Can anybody help me out? > How do I convert a time of day from milliseconds? > For example: > I got the following time in milliseconds: 1,090516451769E+15 > And I want to print it like: 17:14:11.769 > I'm on WinXP > Time zone: GMT +01:00 > > Thank you all! > -- > http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Converting Time question
Hello PythonPeople.. Can anybody help me out? How do I convert a time of day from milliseconds? For example: I got the following time in milliseconds: 1,090516451769E+15 And I want to print it like: 17:14:11.769 I'm on WinXP Time zone: GMT +01:00 Thank you all! -- http://mail.python.org/mailman/listinfo/python-list
No more then 1 Instance of Application..
Hello, Pardon my English... Does anybody know what I have to do to run only 1 instance of my Python Application? How do I check if I'm running more instances of a Application? Thank you all -- http://mail.python.org/mailman/listinfo/python-list
Distutils Error while building 'win32com.client' extension
Hello python people, Can you help me out please. I get the folllowing Error while trying to build a installer with the Distutils module: -- building 'win32com.client' extension 'Python was built with version 7.1 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed.' --- I don't know which library to use so here's my setup.py : from distutils.core import setup, Extension setup(name='Marathon Manager',\ version='0.1.0',\ author='Math',\ py_modules=['modMain','modWindows','modDialogs','modDataBase','ADOConstants'],\ data_files=[('bitmaps', ['gif/schoen.bmp', 'if/run.jpg'])],\ ext_modules=[Extension('win32com.client', ['pythoncom.lib'])]) Thank you all (Again :-)) Math -- http://mail.python.org/mailman/listinfo/python-list
Distutils Error while building 'win32com.client' extension
Hello python people, Can you help me out please. I get the folllowing Error while trying to build a installer with the Distutils module: -- building 'win32com.client' extension 'Python was built with version 7.1 of Visual Studio, and extensions need to be built with the same version of the compiler, but it isn't installed.' --- I don't konw which library to use so here's my setup.py : from distutils.core import setup, Extension setup(name='Marathon Manager',\ version='0.1.0',\ author='Math',\ py_modules=['modMain','modWindows','modDialogs','modDataBase','ADOConstants'],\ data_files=[('bitmaps', ['gif/schoen.bmp', 'if/run.jpg'])],\ ext_modules=[Extension('win32com.client', ['pythoncom.lib'])]) Thank you all (Again :-)) -- http://mail.python.org/mailman/listinfo/python-list
DatBases and Pickle Module
Hello, I wonder if someone can help me out. My native is Dutch, sorry for this But I am writing this program, a program which uses Relational DataBase for saving all kinds of information in records. Now I saw another application which stores all kind of identical data in plain files, but without any kind of DBMS. I wonder how they did this? It also seems alot faster then when working with DBMS. Can I achieve the same in Python with say..the pickle module. For instance a dictionary or something else? Many thanks to you all Math -- http://mail.python.org/mailman/listinfo/python-list