Spring Python 1.0.0-RC2 has been released
Spring Python takes the concepts implemented by the Java-based Spring Framework, and applies them to Python. This provides a powerful library of functionality to help you get back to writing the code that makes you money. It includes features like data access, transaction management, remoting, security, a command-line tool, and an IoC container. Today, release 1.0.0 (RC2) has been released. See http://blog.springpython.webfactional.com/2009/06/03/spring-python-100-rc2-is-released/ for more details about this release, including release notes, links, and other information. -- http://mail.python.org/mailman/listinfo/python-list
Spring Python 1.0.0 (RC1) is released
Spring Python takes the concepts implemented by the Java-based Spring Framework, and applies them to Python. This provides a powerful library of functionality to help you get back to writing the code that makes you money. It includes features like data access, transaction management, remoting, security, a command-line tool, and an IoC container. Today, release 1.0.0 (RC1) has been released. See http://blog.springpython.webfactional.com/index.php/2009/01/22/spring-python-1-0-0-is-finally-here for details about this release, including release notes, links, and other information. This is the production-ready release, with now stable APIs. -- http://mail.python.org/mailman/listinfo/python-list
Spring Python 0 .9.1 has been released
I just released Spring Python 0.9.1. One of our users spotted an error in the a href=http://springpython.webfactional.com/reference/html/ objects.htmlIoC container/a involving constructor arguments, and I was able to reproduce the problem, patch it, and get it released quickly to the user community. You can a href=http://s3browse.com/ explore/dist.springframework.org/release/EXT/se-springpython- py/download it right now/a. Links: * For more information, please visit the website at http://springpython.webfactional.com. * To download the 0.9.1 release, or an archived release, and for access to sample applications use http://www.springsource.com/download/community?project=Spring%20Extensions I cannot emphasize enough how valuable community feedback is to the success of this project. If you are having issues, please a href=http://lists.springsource.com/listmanager/listinfo/springpython- userspost an email to the list/a, or a href=http:// forum.springframework.org/forumdisplay.php?f=45start a thread at the community forum/a, and we will examine the situation. Also note, the web site has been updated, which includes a a href=http://springpython.webfactional.com/pydoc/ springpython.htmllink to API documentation/a, generated by pydoc. == Release Notes - Spring Python - Version 0.9.1 h2Bug /h2 ul li[a href='http://jira.springframework.org/browse/ SESPRINGPYTHONPY-86'SESPRINGPYTHONPY-86/a] - XMLConfig doesn't properly lookup constructor-arg's, but instead returns ReferenceDef objects /li /ul === Key Features of Spring Python include: * Inversion Of Control - The idea is to decouple two classes at the interface level. This lets you build many reusable parts in your software, and your whole application becomes more pluggable. You can use either the XmlApplicationContext or the DecoratorBasedApplicationContext. * Aspect-oriented Programming - Spring Python provides great ways to wrap advice around objects. It is utilized for remoting. Another use is for debug tracers and performance tracing. * DatabaseTemplate - Reading from the database requires a monotonous cycle of opening cursors, reading rows, and closing cursors, along with exception handlers. With this template class, all you need is the SQL query and row-handling function. Spring Python does the rest. * Database Transactions - Wrapping multiple database calls with transactions can make your code hard to read. This module provides multiple ways to define transactions without making things complicated. * Security - Plugin security interceptors to lock down access to your methods, utilizing both authentication and domain authorization. * Remoting - It is easy to convert your local application into a distributed one. If you have already built your client and server pieces using the IoC container, then going from local to distributed is just a configuration change. * Samples - to help demonstrate various features of Spring Python, some sample applications have been created: o PetClinic - Everybody's favorite Spring sample application has been rebuilt from the ground up using various web containers including: CherryPy. Go check it out for an example of how to use this framework. o Spring Wiki - Wikis are powerful ways to store and manage content, so we created a simple one as a demo! o Spring Bot - Use Spring Python to build a tiny bot to manage the IRC channel of your open source project. -- http://mail.python.org/mailman/listinfo/python-list
Spring Python 0.9.0 is released
Spring Python, the python version of the Spring Framework, has just released version 0.9.0. This release includes a key update to springpython.security.web module, where authorization has been patched to support CherryPy 3.1. To download the 0.9.0 release, or an archived release, and for access to sample applications use http://www.springsource.com/download/community?project=Spring%20Extensions Please visit the website at http://springpython.webfactional.com for information about features, releases, source code, licensing, and official documentation. == Release Notes - Spring Python - Version 0.9 Bug * [SESPRINGPYTHONPY-81] - Fix AccessDecisionManager based on CherryPy 3 upgrade Task * [SESPRINGPYTHONPY-76] - Convert sample applications to new XMLConfig format. == Key Features of Spring Python include: * Inversion Of Control - The idea is to decouple two classes at the interface level. This lets you build many reusable parts in your software, and your whole application becomes more pluggable. You can use either the XmlApplicationContext or the DecoratorBasedApplicationContext. * Aspect-oriented Programming - Spring Python provides great ways to wrap advice around objects. It is utilized for remoting. Another use is for debug tracers and performance tracing. * DatabaseTemplate - Reading from the database requires a monotonous cycle of opening cursors, reading rows, and closing cursors, along with exception handlers. With this template class, all you need is the SQL query and row-handling function. Spring Python does the rest. * Database Transactions - Wrapping multiple database calls with transactions can make your code hard to read. This module provides multiple ways to define transactions without making things complicated. * Security - Plugin security interceptors to lock down access to your methods, utilizing both authentication and domain authorization. * Remoting - It is easy to convert your local application into a distributed one. If you have already built your client and server pieces using the IoC container, then going from local to distributed is just a configuration change. * Samples - to help demonstrate various features of Spring Python, some sample applications have been created: o PetClinic - Everybody's favorite Spring sample application has been rebuilt from the ground up using various web containers including: CherryPy. Go check it out for an example of how to use this framework. o Spring Wiki - Wikis are powerful ways to store and manage content, so we created a simple one as a demo! o Spring Bot - Use Spring Python to build a tiny bot to manage the IRC channel of your open source project. -- http://mail.python.org/mailman/listinfo/python-list
Spring Python 0.8.0 has been released/Spring Python goes green
Spring Python, the python version of the Spring Framework, has just released version 0.8.0. This release contains a refactored IoC container supporting four formats (XMLConfig, PythonConfig/@Object, PyContainerConfig, and SpringJavaConfig); replacement of the term component with object in all APIs, classnames, etc.; and other bug fixes and API cleanup. This release also includes a new, spring-green web page you can see at http://springpython.webfactional.com. A key requirement to using this version of Spring Python is installation of Amara XML parsing libraries (https:// fisheye.springframework.org/browse/se-springpython-py/tags/ springpython-release-0.8.0/dependencies) used by Spring Python. You can either follow this link, and download a binary copy of these libraries, or type: easy_install amara This should install amara 1.2. Due to the changes both in IoC container configuration as well as terminology, it is highly recommended you read the updated documentation, especially http://springpython.webfactional.com/reference/html/objects.html. Release Notes - Spring Python - Version 0.8 ** Bug * [SESPRINGPYTHONPY-72] - PetClinic broke in distributed mode. * [SESPRINGPYTHONPY-77] - Intercepted methods cannot handle having arguments that are also intercepted ** Improvement * [SESPRINGPYTHONPY-55] - Include redistributable 3rd party components as part of distribution * [SESPRINGPYTHONPY-59] - Integrate Spring Python publishing with Amazon S3 * [SESPRINGPYTHONPY-71] - SP uses RowCallbackHandler like RowMapper ** New Feature * [SESPRINGPYTHONPY-66] - Add support for nested component definitions in XML application configuration * [SESPRINGPYTHONPY-67] - Add support for constructor-arg dependency injection ** Refactoring * [SESPRINGPYTHONPY-68] - Refactor core container Links: * For more information, please visit the website at http://springpython.webfactional.com. * Framework download at http://s3browse.com/getObject/dist.s...RELEASE.tar.gz * Sample applications at http://s3browse.com/getObject/dist.s...RELEASE.tar.gz * For general browsing of Spring Python releases, visit http://s3browse.com/explore/dist.spr...ringpython-py/ Key Features of Spring Python include: * Inversion Of Control - The idea is to decouple two classes at the interface level. This lets you build many reusable parts in your software, and your whole application becomes more pluggable. You can use either the XmlApplicationContext or the DecoratorBasedApplicationContext. * Aspect-oriented Programming - Spring Python provides great ways to wrap advice around objects. It is utilized for remoting. Another use is for debug tracers and performance tracing. * DatabaseTemplate - Reading from the database requires a monotonous cycle of opening cursors, reading rows, and closing cursors, along with exception handlers. With this template class, all you need is the SQL query and row-handling function. Spring Python does the rest. * Database Transactions - Wrapping multiple database calls with transactions can make your code hard to read. This module provides multiple ways to define transactions without making things complicated. * Security - Plugin security interceptors to lock down access to your methods, utilizing both authentication and domain authorization. * Remoting - It is easy to convert your local application into a distributed one. If you have already built your client and server pieces using the IoC container, then going from local to distributed is just a configuration change. * Samples - to help demonstrate various features of Spring Python, some sample applications have been created: o PetClinic - Everybody's favorite Spring sample application has been rebuilt from the ground up using various web containers including: CherryPy. Go check it out for an example of how to use this framework. o Spring Wiki - Wikis are powerful ways to store and manage content, so we created a simple one as a demo! o Spring Bot - Use Spring Python to build a tiny bot to manage the IRC channel of your open source project. -- http://mail.python.org/mailman/listinfo/python-list
Re: Spring Python 0.8.0 has been released/Spring Python goes green
The Links section has some faults in it. Here is a corrected copy: Links: For more information, please visit the website at http://springpython.webfactional.com Framework download at http://s3browse.com/getObject/dist.springframework.org/release/EXT/se-springpython-py/springpython-0.8.0-RELEASE.tar.gz Sample applications at http://s3browse.com/getObject/dist.springframework.org/release/EXT/se-springpython-py/springpython-samples-0.8.0-RELEASE.tar.gz For general browsing of Spring Python releases, visit http://s3browse.com/explore/dist.springframework.org/release/EXT/se-springpython-py/ -- http://mail.python.org/mailman/listinfo/python-list
Re: wrapping a method function call?
Spring Python provides an AOP solution (http:// springpython.webfactional.com/reference/html/aop.html). You can define regexp patterns of what you want to intercept. Imagine having this service: class SampleService: def method(self, data): return You sent me '%s' % data def do_something(self): return Okay, I'm doing something You can write a simple interceptor that wraps the results: from springpython.aop import * class WrappingInterceptor(MethodInterceptor): Interceptor that is called before the real method, and has access afterwards to the results def invoke(self, invocation): print BEFORE... results = Wrapped + invocation.proceed() + /Wrapped print AFTER return results Simply creating an instance of your base class acts as you would expect: service = SampleService() print service.method(something) You sent me 'something' Change one line, and your interceptor is plugged in: service = ProxyFactoryComponent(target = SampleService(), interceptors = [WrappingInterceptor()]) print service.method(something) WrappedYou sent me 'something'/Wrapped Visit the website at http://springpython.webfactional.com, and read about AOP, along with the other features provided by this library. -- http://mail.python.org/mailman/listinfo/python-list
Spring Python 0.7.1 has been released
Spring Python, the python version of the Spring Framework, has just released version 0.7.1. This patch includes integration with S3, Spring's new service used to distribute binaries. Key Features of Spring Python include: * Inversion Of Control - The idea is to decouple two classes at the interface level. This lets you build many reusable parts in your software, and your whole application becomes more pluggable. You can use either the XmlApplicationContext or the DecoratorBasedApplicationContext. * Aspect-oriented Programming - Spring Python provides great ways to wrap advice around objects. It is utilized for remoting. Another use is for debug tracers and performance tracing. * DatabaseTemplate - Reading from the database requires a monotonous cycle of opening cursors, reading rows, and closing cursors, along with exception handlers. With this template class, all you need is the SQL query and row-handling function. Spring Python does the rest. * Database Transactions - Wrapping multiple database calls with transactions can make your code hard to read. This module provides multiple ways to define transactions without making things complicated. * Security - Plugin security interceptors to lock down access to your methods, utilizing both authentication and domain authorization. * Remoting - It is easy to convert your local application into a distributed one. If you have already built your client and server pieces using the IoC container, then going from local to distributed is just a configuration change. * Samples - to help demonstrate various features of Spring Python, some sample applications have been created: o PetClinic - Everybody's favorite Spring sample application has been rebuilt from the ground up using various web containers including: CherryPy. Go check it out for an example of how to use this framework. o Spring Wiki - Wikis are powerful ways to store and manage content, so we created a simple one as a demo! o Spring Bot - Use Spring Python to build a tiny bot to manage the IRC channel of your open source project. Links: * For more information, please visit the website at http://springpython.webfactional.com. * Framework download at http://s3browse.com/getObject/dist.springframework.org/release/EXT/se-springpython-py/springpython-0.7.1-RELEASE.tar.gz * Sample applications at http://s3browse.com/getObject/dist.springframework.org/release/EXT/se-springpython-py/springpython-samples-0.7.1-RELEASE.tar.gz * For general browsing of Spring Python releases, visit http://s3browse.com/explore/dist.springframework.org/release/EXT/se-springpython-py/ Release Notes - Spring Python - Version 0.7.1 ** Improvement * [SESPRINGPYTHONPY-59] - Integrate Spring Python publishing with Amazon S3 * [SESPRINGPYTHONPY-73] - Clean up reference documentation based on new APIs since scrubbing ** Refactoring * [SESPRINGPYTHONPY-74] - Update core container interface to bring in line with Python standard style guide. -- http://mail.python.org/mailman/listinfo/python-list
Re: Spring Python 0.7.0 is released
Key Features The following features have been implemented: * Inversion Of Control - The idea is to decouple two classes at the interface level. This lets you build many reusable parts in your software, and your whole application becomes more pluggable. You can use either the XmlApplicationContext or the DecoratorBasedApplicationContext. * Aspect-oriented Programming - Spring Python provides great ways to wrap advice around objects. It is utilized for remoting. Another use is for debug tracers and performance tracing. * DatabaseTemplate - Reading from the database requires a monotonous cycle of opening cursors, reading rows, and closing cursors, along with exception handlers. With this template class, all you need is the SQL query and row-handling function. Spring Python does the rest. * Database Transactions - Wrapping multiple database calls with transactions can make your code hard to read. This module provides multiple ways to define transactions without making things complicated. * Security - Plugin security interceptors to lock down access to your methods, utilizing both authentication and domain authorization. * Remoting - It is easy to convert your local application into a distributed one. If you have already built your client and server pieces using the IoC container, then going from local to distributed is just a configuration change. * Samples - to help demonstrate various features of Spring Python, some sample applications have been created: o PetClinic - Everybody's favorite Spring sample application has been rebuilt from the ground up using various web containers including: CherryPy. Go check it out for an example of how to use this framework. o Spring Wiki - Wikis are powerful ways to store and manage content, so we created a simple one as a demo! o Spring Bot - Use Spring Python to build a tiny bot to manage the IRC channel of your open source project. For more information, please visit the website at http://springpython.webfactional.com, where you will also find more detailed documentation at http://springpython.webfactional.com/reference/html/. Greg Turnquist -- http://mail.python.org/mailman/listinfo/python-list
Spring Python 0.7.0 is released
Release 0.7.0 was completed last night, and released to sourceforge.net. NOTE: This release included a lot of API scrubbing, in order to bring things more in tune with PEP-0008 (python's style guide). You're existing apps PROBABLY were impacted, if you used any of Spring Python's utility classes. Since we are pre-1.0, this is the best time for such a cleanup. When 1.0 hits the streets, we won't make such a sweeping change without extensive backwards support. See [url]http://springpython.webfactional.com[/url] for more information. Visit our community forum at [url]http://forum.springframework.org/ forumdisplay.php?f=45[/url] for current threads of discussion. --Greg Turnquist, Spring Python project lead = Release Notes - Spring Python - Version 0.7 ** Bug * [SESPRINGPYTHONPY-63] - Running setup.py returns an exception ** Improvement * [SESPRINGPYTHONPY-49] - Upgrade PetClinic to CherryPy 3.1 * [SESPRINGPYTHONPY-64] - Adding a schema for the regular component elements * [SESPRINGPYTHONPY-69] - Remove deprecated connection factories from baseline * [SESPRINGPYTHONPY-70] - Scrub function/attribute naming conventions to more closely follow PEP-0008. ** New Feature * [SESPRINGPYTHONPY-61] - Generate reference documentation for the project ** Refactoring * [SESPRINGPYTHONPY-65] - Change 'type' attribute in XML application config to 'scope' to be in line with the lifetime concept in other Spring platforms -- http://mail.python.org/mailman/listinfo/python-list
Spring Python 0.6.0 has been released
Spring Python 0.6.0, the python offshoot of the Spring framework and Spring Security, has been released (http:// springpython.webfactional.com). See http://sourceforge.net/project/showfiles.php?group_id=184275package_id=214366release_id=624328 for more details. BTW, if you click on the release notes link, there is a report pulled from JIRA (our new bug tracking software) showing the issues. For more details, you have to create an account at jira.springframework.org, and then surf to Spring Python. There, you can see it all nicely bundled at http://jira.springframework.org/secure/IssueNavigator.jspa?reset=truepid=10270fixfor=11085. Spring Python is moving forward in tremendous ways! Working with the build team in England, we have gotten things integrated with a continuous integration server. See http://build.springframework.org/browse/EXT, and then surf into the Spring Python parts to see our results. This is great! Just check out http://build.springframework.org/browse/EXT-PYQUICK-19 for archived sample of the success of this project. If you look closely, you may notice that MySQL and PostGreSQL test cases have been commented out. That is because we don't have support for those RDBMS's on CI at this point in time. Don't be alarmed. I have run tests with and without thos test suites, and the difference in code coverage is 85% vs. 83%. Hopefully, in the future, we can get an integration environment that includes those tests as well. This project focuses on quality. That is why I started this project using TDD practices and intend to proceed in this fashion. By integrating with CI, we now have true visibility into this. Another goal is to get code coverage metrics captured. Tools have been updated and show a measurement of 83% at this point in time. I don't know the industry average, but I'm willing to bet it is way below that. I am personally test infected, and I want to see the number higher. The next immediate thing is to update Spring Python to support CherryPy 3.1. We are way behind and need to catch up. I have been working with Sylvain, author of CherryPy Essentials: Rapid Python Web Application Development, and we are close to getting PetClinic and all the supporting components of Spring Python working. This is exciting because integrating with 3rd party web frameworks opens doors for Spring Python. Have any ideas of where you think Spring Python can go? Send me a message here, or start a new topic on our forum at http://forum.springframework.org/forumdisplay.php?f=45. -- http://mail.python.org/mailman/listinfo/python-list
Spring Python version 0.5.0 is released
Spring Python (http://springpython.webfactional.com) version 0.5.0 was released today. It contains updates to DatabaseTemplate and DatabaseTransactions, along with more testing underneath MySQL, PostGreSQL, and Sqlite. Support for Oracle has been added, but only minimally tested so far. Spring Python has been re-licensed underneath the Apache License 2.0, making it more business friendly. Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: virtualpython / workingenv / virtualenv ... shouldn't this be part of python
On Jan 11, 11:45 am, Christian Heimes [EMAIL PROTECTED] wrote: Damjan wrote: My question is, shoudn't it be enough to set PYTHONPATH and everything automagically to work then? Is there some work done on this for python 3.0 or 2.6 perhaps? I'm working on a PEP for a per user site dir for 2.6 and 3.0 Christian What about security holes, like a malicious version of socket getting downloaded into a user's directory, and overriding the default, safe version? Don't forget that in your PEP. -- http://mail.python.org/mailman/listinfo/python-list
Spring Python 0.3.2 is release!
Spring Python (http://springpython.python-hosting.com) version 0.3.2 was released yesterday. It contains a patch to an error discovered 12/19/2007 in XmlApplicationContext, that broke when PROTOTYPE scoping was used. Test cases have been updated to detect this bug, and in turn the correction was made in released. Get it while its hot! -- http://mail.python.org/mailman/listinfo/python-list
Re: matching a street address with regular expressions
Don't forget to write test cases. If you have a series of addresses, and confirm they are parsed correctly, you are in a good position to refine the pattern. You will instantly know if a change in pattern has broken another pattern. The reason I'm saying this, is because I think your pattern is incomplete. I suggest you add a test case for the following street address: 221B Baker Street That is a real address in London (only Sherlock Holmes) was fiction. I know it, because I actually visited the location. Can you address matching pattern handle that? Just don't break other address recognition test cases while fixing things. -- http://mail.python.org/mailman/listinfo/python-list
Re: determining fully qualified package class name
import myPackage f = myPackage.foo() print f.__module__ + . + f.__class__.__name__ That should do it! -- http://mail.python.org/mailman/listinfo/python-list
Re: EasyMock for python ?
I had to get the hang of jMock-style testing through the usage of the pmock library. But it seems to work out pretty well. See some of my test cases at http://springpython.python-hosting.com/browser/trunk/src/springpython/test/databaseCoreTestCases.py. That should provide a hearty sample of uses for this mock set. It easily let me throw away the real database and conclude unit testing much faster. -- http://mail.python.org/mailman/listinfo/python-list
Re: Spring Python 0.3.0 is released!
Spring Python 0.3.1 was released today. It contains a quick add-on feature: DecoratorBasedApplicationContext. This feature lets you define an IoC container using python code and decorators instead of an XML flat file. It handles things like dependency injection and fetches things in order as needed. It also supports two scopes: PROTOTYPE and SINGLETON. Get it while its hot! -- http://mail.python.org/mailman/listinfo/python-list
Spring Python 0.3.0 is released!
Spring Python (http://springpython.python-hosting.com) version 0.3.0 was released yesterday. Key improvements include: * Make the web components WSGI-compatible, firstly working with CherryPy. * Extend PetClinic to use database accounts and have password encoding. * Add an ExceptionTranslationFilter so PetClinic handles errors more sophisticated. * Relicense Spring Python underneath GPLv3. * Generally, clean up the code and test cases. Also start using code coverage tools to improve quality of testing. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Database Apps
I use MySQL and also sqlite. However, I also use Spring Python (http:// springpython.python-hosting.com) to use both its DatabaseTemplate utility class and also the remoting functionality. This way, I can have the database code sitting on the server, and then export the data access functions remotely to clients. It is also relatively easy to swap out database engines. For the record: Spring Python is my pet project. I use it myself, and recommend it to others as well. -- http://mail.python.org/mailman/listinfo/python-list
Re: Creating a multi-tier client/server application
Perhaps Spring Python can help you out (http://springpython.python- hosting.com). It reuses technologies like Pyro for remoting, offers database templates, has a plugable security component, an AOP solution should the need arise, an IoC container, and has a couple of web-app demos using CherryPy. Of course, you can use whatever web stack you want. I just picked CherryPy to demo things. Each component of Spring Python is optional, and you can use it through the IoC container, or programatically. This might help you leverage development of an enterprise app. BTW, I have plans to implement a wxPython front end sample app. I just haven't done it yet. Good luck! -- http://mail.python.org/mailman/listinfo/python-list
Re: Authenticating clients and servers
On Apr 15, 2:40 pm, Chaz Ginger [EMAIL PROTECTED] wrote: Thomas Krüger wrote: Chaz Ginger schrieb: I am writing a distributed server system using Python. I need to support authentication and was wondering what approaches are available under Python and what are the best practices. Spring Python has a section concerning Application Security you may be interested in. (http://springpython.python-hosting.com/wiki/ ApplicationSecurity). This offers the ability to authenticate users, but also manage what functions they can execute based on granted roles through aspect oriented programming. Right now, the current release supports flat-file user systems, but the next release will also include database user stores. There are future plans to integrate with other user stores like LDAP and so forth. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and Java
On Apr 5, 7:18 am, Steve Holden [EMAIL PROTECTED] wrote: Sreelatha G wrote: Hi I am new to python .I need your help in solving my problem. Is there any way to call python files in a java file .How is it possible? Your other option is to utilize a system exec call, and try and trap the results. -- http://mail.python.org/mailman/listinfo/python-list
Re: how to build a forum in Python?
Sounds like phpBB (http://www.phpbb.com/) would do great. I'm not sure why you want to go write another forum management tool when others are already out there for usage. I know its not in python, but not everything has to be in python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Newbie - needs help
Nothing beats http://diveintopython.org/toc/index.html for getting into the basics of Python. This guy's writing is great! -- http://mail.python.org/mailman/listinfo/python-list
Re: how to remove multiple occurrences of a string within a list?
I don't think I would use sets at all. They change the semantic meaning of the original list. What if you have duplicate entries that you want to keep? Converting to a set and back will strip out the duplicates of that. -- http://mail.python.org/mailman/listinfo/python-list
Re: newbi question on python rpc server, how it works?
I have a need where I need to create a layer of business logic that will connect to mysql database at one end and a wxpython based thin client at the other end. Spring Python offers something similar (http://springpython.python- hosting.com/wiki/DistributedRemoting) to link up clients withs servers. You can code locally, and then when it is time to split things up between different workstations, you can reconfigure the networking. There is a demo application, PetClinic (http://springpython.python- hosting.com/wiki/PetClinic) that shows a database component, remoting pieces, and finally a front end. The current version of PetClinic is a web app. In the near future, we are planning to build a wxPython front end to show more reusability of components. -- http://mail.python.org/mailman/listinfo/python-list
Re: Single string print statements on multiple lines.
http://www.catb.org/~esr/faqs/smart-questions.html Don't post homework questions. -- http://mail.python.org/mailman/listinfo/python-list
Re: New to Python
I read http://diveintopython.org/ online, and covered a lot of Python territory nicely with this. Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: using python to visit web sites and print the web sites image to files
You can definitely create a web bot with python. It doesn't require that you drive A real web browser. There are libraries to open web pages, scrape their contents, and do downloading. That would make your bot platform neutral. Driving a GUI browser has the risk of being a brittle script that might not handle different browsers, different platforms, maybe even not handle different versions. I run a mediawiki web site, and found a handy python-based library written to manage it called pywikipediabot at http://sourceforge.net/projects/pywikipediabot/. Okay, this library won't do your leg work for you, but it has pieces and parts that demonstrate how to use python to surf a web site. Then, with an HTML parser, you can hunt down images. Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Interface Implementation in Python
I would like to know the interface concept in Python.How the Interface is defined and implemented in Python?. One way I have implemented interfaces, is as follows: class MyInterface(object): def someMethod(self, argument): raise NotImplementedError() If anybody ever uses that class directly, or subclasses it without implementing a real version of that method, a runtime error can be expected. This bridges both interfaces and abstract classes. As others have pointed out, this isn't quite like a Java interface, but I have found it useful to state my intentions up front, and that is how I do it. The only way to truly enforce this is by following up with lots of good test cases, run often. -- http://mail.python.org/mailman/listinfo/python-list
Re: package_data question
On Mar 5, 1:56 am, bytecolor [EMAIL PROTECTED] wrote: I have a simple package. I'm trying to add an examples subdirectory with distutils. I'm using Python 2.4 on Linux. My file layout and setup.py can be found here: http://www.deadbeefbabe.org/paste/3870 I've tried using data_files as well, with the same result; examples/ fig2.3.apt is not added to the tarball. -- bytecolor I have a package along with a samples section. I have both a setup.py script along with a MANIFEST.in file to make sure everything gets in. You can see both of the files at https://springpython.python-hosting.com/browser/trunk/samples That is for the samples section. For my main package, I have something similar at https://springpython.python-hosting.com/browser/trunk/src -- http://mail.python.org/mailman/listinfo/python-list
Re: Module trouble [newbie]
On Feb 23, 6:44 am, Boris Ozegovic [EMAIL PROTECTED] wrote: Can somebody explaint this to me: I have module a.py A = 100 import b print A printing print B is %s % b.B and module b.py B = 2000 import a print B printing print A is %s % a.A I thought that output would be: B printing A is 100 A printing B is 2000 Because import b would execute b.py, and in b.py line import a would be ignored, but my output is: import a 100 A printing B is 100 ?? :) --http://www.nacional.hr/articles/view/23894/23 a.py === A = 100 import b print A printing print B is %s % b.B b.py === B = 2000 import a print B printing print A is %s % a.A Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import a B printing A is 100 A printing B is 2000 Looks okay to me. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to do a Decorator Here?
On Feb 20, 8:20 pm, Gregory Piñero [EMAIL PROTECTED] wrote: Need some decorator help. I have a class. And I want to add behavior to one of this class's methods to be run before the class runs the actual method. Is this what decorators are for? So the class I want to work with is string.Template Let's say I have this: from string import Template a=Template($var1 is a test) def preprocess(var1): #Real code here will be more complicated, just an example var1=var1.upper() a.substitute(var1=greg) So how can I have preprocess run before substitute is run? I want the user to be able to call a.substitute and have preprocess run automatically. Or is this not what decorators do? I'm trying to avoid subclassing if I can. Thanks in advance for the help. -Greg That sounds like aspect oriented programming. Spring Python (http:// springpython.python-hosting.com) offers a way to wrap objects with method interceptors. Method interceptors give you full control before and after method calls. Sometimes decorators can be used to do that as well, but they have constraints in where they can be used. I found them too inflexible for my needs, so I built an AOP solution. Greg -- http://mail.python.org/mailman/listinfo/python-list
Re: Approaches of interprocess communication
On Feb 16, 5:11 am, exhuma.twn [EMAIL PROTECTED] wrote: Hi all, Supposing you have two separate processes running on the same box, what approach would you suggest to communicate between those two processes. Spring Python makes it easy to get processes talking to each other. You can write your code like you are talking locally, then when its time to separate it either into another thread, another python process, or on another node, it is just a reconfiguration issue. http://springpython.python-hosting.com/wiki/DistributedRemoting -- http://mail.python.org/mailman/listinfo/python-list
Re: probably a stupid question: MatLab equivalent of diff ?
On 12/29/06, Stef Mientki [EMAIL PROTECTED] wrote: Does anyone know the equivalent of the MatLab diff function. The diff functions calculates the difference between 2 succeeding elements of an array. I need to detect (fast) the falling edge of a binary signal. There's derivate function in Python diff, but when you use an binary (true/false) input, it also detects rising edges. Probably a stupid question, but I still have troubles, digging to huge amount of information about Python. thanks, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list Stef, Can you provide more context on your use-- are you receiving binary data sequentially, or do you have a list or array of binary values? Are you using numpy/scipy? Marcus -- http://mail.python.org/mailman/listinfo/python-list
Re: internet explorer/firefox plugin/toolbar
does anyone have any ideas as to how to go about creating a plugin/toolbar for both/either the IE/Firefox browsers? For IE, checkout Browser Helper Objects (BHOs). Sample python code can be found at: http://aspn.activestate.com/ASPN/Mail/Message/ctypes-users/2263094 Marcus -- http://mail.python.org/mailman/listinfo/python-list
help with binary file io, perhaps with generators?
I need to write a fast file reader in python for binary files structured as: x[0] y[0] z[0] x[1] y[1] z[1] where c[k] is the k-th element from sequence c. As mentioned, the file is binary -- spaces above are just for visualization. Each element, c[k], is a 16-bit int. I can assume I know the number of sequences in the file a priori. Files are stored and processed on a WinXP machine (in case Endian-ness matters). I'm looking for suggestions on how to tackle this problem, and how to design my reader class. Or if anyone has sample code: that would be appreciated, too. Some questions I have to start with: (i) should I use generators for iterating over the file? (ii) how can I handle the 16-bit word aspect of the binary data? (iii) ultimately, the data will need to be processed in chunks of M-values at a time... I assume this means I need some form of buffered io wrapper, but I'm not sure where to start with this. Thanks! Marcus Ps -- this seems like a general stream processing problem if anyone can recommend good refs (web) on stream processing -- http://mail.python.org/mailman/listinfo/python-list
Re: pythonic use of properties?
On 4/15/05, Michael Spencer [EMAIL PROTECTED] wrote: class SillyDecimal(object): A silly class to represent an integer from 0 - 99. def __init__(self, arg=17): if isinstance(arg, tuple): self.tens = arg[0] self.ones = arg[1] It is conventional to indicate 'private' attributes with the _ prefix. Well, I actually want to expose tens and ones, which is why they are not private. By this standard, you have three 'public' interfaces: number, get/setNumber and ones/tens, which is confusing and error-prone. Moreover, if you are going to validate number, it might make more sense to put all the validation logic into the setter vs. splitting some into __init__. So your class could look like: Of course the toy example would be better coded by changing the internal representation to number (instead of tens and ones), but then the point about property validation is lost, as you demonstrate in your example. As for whether it is appropriate to validate the value at all, I think that depends on your larger design. So what do you consider when making this decision, and do these factors differ between python and C#/Java? Marcus -- http://mail.python.org/mailman/listinfo/python-list
Re: Using python from a browser
I read that IE had the capability to embedd Python scripts, but what about the others ? While Python can be set up as a scripting language for IE, this is normally disabled as it could be a security hole. The open call is available from Python scripts so a web site could read or destroy your files. Slightly off-topic, it is possible to use browser helper objects (bhos) with Internet Explorer: http://starship.python.net/crew/theller/moin.cgi/CtypesLinks Marcus -- http://mail.python.org/mailman/listinfo/python-list
pythonic use of properties?
I'd like advice/opinions on when it is appropriate to do attribute/property validation in python. I'm coming from a C#/Java background, where of course tons of wasted code is devoted to property validation. Here is a toy example illustrating my question: # Example: mixing instance attributes with properties. Is it pythonic to # validate property data in setters? Since tens and ones are never # validated, the class can be broken by setting these directly class SillyDecimal(object): A silly class to represent an integer from 0 - 99. def __init__(self, arg=17): if isinstance(arg, tuple): self.tens = arg[0] self.ones = arg[1] else: self.number = arg def getNumber(self): return self.tens*10 + self.ones def setNumber(self, value): if value 0 or value 99: raise ArgumentException(Must in [0, 99]) self.tens = value // 10 self.ones = value % 10 number = property(getNumber, setNumber, None, Complete number, [0-99]) x = SillyDecimal() x.number, x.tens, x.ones# returns (17, 7, 1) Even though tens, ones and number all appear as attributes, only number has its input validated. Since the class is designed to only hold numbers 0 - 99, one can 'break' it by setting self.tens=11, for example. Should tens and ones be made into full-fledged properties and validated? Should number have no validation? Is it more pythonic to encapsulate tightly, or rely on responsible use. Marcus -- http://mail.python.org/mailman/listinfo/python-list
Re: Finding attributes in a list
class Player(object): def __init__(self, **kw): self.__dict__.update(kw) def __repr__(self): return 'Player %s'%getattr(self, 'name', '(anonymous)') import operator [p.name for p in sorted(players, key=operator.attrgetter('attacking'), reverse=True)] Just happened to read this thread and wanted to say this is a neat little example-- thank you! I have a couple of followup questions. (1) Is there a performance penalty for using key=operator.attrgetter()? (2) The Player class looks like a nice model for a data table when one wants to sort by arbitrary column. Would you agree? (3) Suppose one wished to construct a player list from a collection of attribute lists, e.g., names = ['bob', 'sam', 'linda'] attack = [7, 5, 8] defense = [6, 8, 6] # construct players list here Can you recommend an efficient way to construct the player list? Thanks! Marcus -- http://mail.python.org/mailman/listinfo/python-list