Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #35440
| Date | 2012-12-24 06:18 +0100 |
|---|---|
| From | Thomas Bach <thbach@students.uni-mainz.de> |
| Subject | Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) |
| References | <37264cd5-8acd-416b-a808-50216f9fbfa0@googlegroups.com> <mailman.1220.1356260119.29569.python-list@python.org> <mailman.1225.1356296379.29569.python-list@python.org> <roy-52F25F.16151223122012@news.panix.com> <3f14f739-e660-4883-a940-c77a6092cb79@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1239.1356326349.29569.python-list@python.org> (permalink) |
Hi there,
On Sun, Dec 23, 2012 at 01:42:14PM -0800, prilisauer@googlemail.com wrote:
> […] In the lower section you see, that the modules should execute
> sqls. In case It could occur that two queries occur at the same
> time. PS: IT IS NOT A QUESTION ABOUT SQL, etc. I do not understand,
> how I could handle the part which is marked with Problemsection1 and
> Problemsection2
I actually do not understand the problem you are stating. But, did you
have a look at SQLAlchemy? If you are coping a lot with SQL it really
makes your life much easier and they also provide the necessary
mechanisms for threading.
> import HomeLog # LogHandler
Modules should be written all lower-case separated by underscores.
> # Attach Loghandler
> Loghandler = HomeLog.Logging()
Have a look at the logging module and tutorial. I don't know what is
in HomeLog.Logging, but this doesn't seem right.
Variables defined at module level should be written all upper-case.
> # Attach SocketServer
> HomeSocketServer.HomeSocketServerStart()
>
> # Attach Scheduler
> HomeSched = HomeScheduler.HomeScheduler()
> […]
> # This is a "Sample" that builds 2byte Cmd and transmits it on bus
> PowerOnLamp1=Dali.send(0,0,1,80)
You do all this on the module level? These things should go into
functions with proper names or at least into a
if __name__ == '__main__':
pass
> ###############################################################
> HomeDaliServer.py
> ........
> def send (self,DaliAdress,RequestType,Request,RequestValue):
> # Problemsection1:
> # Here it's getting Interesting
> # We're at the HomeDaliServer, and now I want to use QuerySqlite()
> in the file HomeDatastore.py
So, where's the problem?
# make sure not to introduce cyclic dependence here!
import home_data_store
def send (connection,DaliAdress,RequestType,Request,RequestValue):
results = home_data_store.query_sqlite(connection, …)
return results
> ###############################################################
> HomeScheduler.py
> # Problemsection2:
> # If new workerthread is started, Informations must be queried using
> QuerySlite() and also update data
So, here's a first sketch (untested):
def query():
data = do_something()
return data
def update(data):
do_something_with(data)
> HomeDatastore.py
> def QuerySqlite():
> #doing something here..
> # returning Data
Have you read the Python tutorial by the way?
Regards,
Thomas.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-22 02:59 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Peter Otten <__peter__@web.de> - 2012-12-22 12:43 +0100
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-22 04:38 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Peter Otten <__peter__@web.de> - 2012-12-22 14:54 +0100
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-22 08:36 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-22 08:36 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-22 04:38 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-22 04:45 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Terry Reedy <tjreedy@udel.edu> - 2012-12-22 16:30 -0500
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-22 04:45 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Alexander Blinne <news@blinne.net> - 2012-12-22 18:26 +0100
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-22 10:10 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Alexander Blinne <news@blinne.net> - 2012-12-22 20:29 +0100
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-22 12:43 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Alexander Blinne <news@blinne.net> - 2012-12-22 22:59 +0100
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-23 01:32 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Terry Reedy <tjreedy@udel.edu> - 2012-12-23 20:53 -0500
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Alexander Blinne <news@blinne.net> - 2012-12-24 14:10 +0100
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Dave Angel <d@davea.name> - 2012-12-22 17:03 -0500
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Cameron Simpson <cs@zip.com.au> - 2012-12-23 21:55 +1100
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-23 12:59 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Peter Otten <__peter__@web.de> - 2012-12-23 22:14 +0100
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-23 12:59 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Roy Smith <roy@panix.com> - 2012-12-23 16:15 -0500
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-23 13:42 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2012-12-23 23:38 +0000
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-12-24 00:01 -0500
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Thomas Bach <thbach@students.uni-mainz.de> - 2012-12-24 06:18 +0100
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Dave Angel <d@davea.name> - 2012-12-24 00:19 -0500
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-24 00:23 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Cameron Simpson <cs@zip.com.au> - 2012-12-24 21:32 +1100
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Dave Angel <d@davea.name> - 2012-12-24 10:48 -0500
Re: [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Ranting Rick <rantingrickjohnson@gmail.com> - 2012-12-24 21:10 -0800
Re: [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-25 04:55 -0800
Re: [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-12-25 16:04 -0500
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Dave Angel <d@davea.name> - 2012-12-24 11:47 -0500
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Dave Angel <d@davea.name> - 2012-12-24 18:09 -0500
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-24 00:23 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-25 13:44 +0000
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-25 06:41 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Dave Angel <d@davea.name> - 2012-12-25 12:10 -0500
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-25 09:31 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-25 09:31 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Rick Johnson <rantingrickjohnson@gmail.com> - 2012-12-25 12:16 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-12-25 16:08 -0500
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Rick Johnson <rantingrickjohnson@gmail.com> - 2012-12-25 15:42 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Michael Torrie <torriem@gmail.com> - 2012-12-26 12:20 -0700
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Michael Torrie <torriem@gmail.com> - 2012-12-26 11:58 -0700
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Rick Johnson <rantingrickjohnson@gmail.com> - 2012-12-25 15:42 -0800
Re: [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) alex23 <wuwei23@gmail.com> - 2012-12-25 19:18 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Rick Johnson <rantingrickjohnson@gmail.com> - 2012-12-25 12:16 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-25 22:56 +0000
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Rick Johnson <rantingrickjohnson@gmail.com> - 2012-12-25 16:19 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-26 08:29 +0000
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Rick Johnson <rantingrickjohnson@gmail.com> - 2012-12-26 20:07 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-12-27 05:02 +0000
Re: [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Ranting Rick <rantingrickjohnson@gmail.com> - 2012-12-26 22:50 -0800
Re: [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) Chris Angelico <rosuav@gmail.com> - 2012-12-27 23:58 +1100
Re: Require help migrating from Perl to Python 2.7 (namespaces) alex23 <wuwei23@gmail.com> - 2012-12-27 05:25 -0800
Re: [Help] [Newbie] Require help migrating from Perl to Python 2.7 (namespaces) prilisauer@googlemail.com - 2012-12-23 01:36 -0800
csiph-web