Re: how to find position of dictionary values

2008-09-01 Thread Diez B. Roggisch
lee wrote: > On Sep 1, 1:45 pm, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: >> lee a écrit : >> >> > hi, >> > i have a dictionary as follows : >> > kev : {'phno': ['dgsd', 'gsdg', 'dfsdf', 'g'], 'email': ['dg', >> > 'sgsd', 'sdfsdf', 'gdf'], 'name': ['ds', 'dsg', 'dsfds', 'fgdf'], >> > 'addres

Re: Using NLTK in Java

2008-09-01 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > On 1 Sep, 11:55, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] schrieb: >> >> > I am trying to convert a python module (that contains the use of >> > NLTK.Corpus) by jythonc. It is not able to includ

Re: encoding

2008-09-01 Thread Diez B. Roggisch
Gandalf schrieb: if i want to print utf-8 string i should writre: print u"hello word" No, you don't. You write print u"hello world".encode("utf-8") Read this: http://www.reportlab.com/i18n/python_unicode_tutorial.html but what happen if i want to print variable? Then you do print varia

Re: SQL package

2008-09-02 Thread Diez B. Roggisch
Juan schrieb: Hi I am trying to write a little a script that can be configurable. This script should access to a database, that can be of any type (MySQL, Postgres, SQLite, MS, etc).It has only to perform 2 or 3 simple plain SQL queries. Hi have tested SQLAlchemy, and it is great, but too much f

Re: dict.update

2008-09-02 Thread Diez B. Roggisch
Mike P schrieb: Hi All, I have two dictionaries e.g dict1 = {123:3,234:5,456:3} dict2 = {123:4,157:2,234:5,456:3,567:2} I want to merge these two dictionaries together so i have a resultant dictionary of: dict3 = {123:[4,3],157:[2,0],234:[5,5],456:[3,3],567:[2,0]} As later on i want to write

Re: source for the property function

2008-09-02 Thread Diez B. Roggisch
Rowland Smith schrieb: Anyone know where the source code for the built-in property function is located in a python distribution? I would like to see how it works - mainly, how does it know which class it is being called from? Google the "descriptor protocol" for new-style classes. That expl

Re: How to write verbose scripts

2008-09-02 Thread Diez B. Roggisch
Steven D'Aprano schrieb: I find myself writing command line tools in Python where I wish to include "verbose" output to stdout. I start with a helper function: def print_(obj, level=0): if _verbosity >= level: print obj And then I end up with functions or methods looking like th

Re: synthetic properties

2008-09-02 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: I'm trying to come up with solution for adding synthetic properties to python, similar to synthetic properties in Objective-C. I'm playing around with doing this in a MetaClass. I can dynamically create the attributes that will back the property, but I'm having troubl

Re: Pass same parameter in Recursive function

2008-09-03 Thread Diez B. Roggisch
Davy schrieb: On Sep 3, 11:57 am, "Chris Rebert" <[EMAIL PROTECTED]> wrote: Assuming the function is tail-recursive or the "unchanging" arguments are immutable, just use a closure: [SNIP] Hi Chris, Thank you :) Perhaps I should clarify the problem. 1. the function is NOT tail-recursive 2. Yes,

Re: installing matplotlib with numpy and scipy for Python in Cygwin

2008-09-03 Thread Diez B. Roggisch
Anish Chapagain schrieb: On Sep 3, 12:39 pm, Uwe Schmitt <[EMAIL PROTECTED]> wrote: On 3 Sep., 11:42, "chapagainanish" <[EMAIL PROTECTED]> wrote: Hi!! I'm having installation problem for installing numpy and scipy in Cygwin for Python, and am obstruct in madway for project, i followed scipy.or

Re: properties setting each other

2008-09-03 Thread Diez B. Roggisch
mk schrieb: Hello everyone, I try to set two properties, "value" and "square" in the following code, and arrange it in such way that setting one property also sets another one and vice versa. But the code seems to get Python into infinite loop: >>> import math >>> class Squared2(object):

Re: Serial I/O problem with pywin32 ?

2008-09-03 Thread Diez B. Roggisch
Xavier schrieb: Hi, I try to access to a Bluetooth GPS data-logger with Python. I use pySerial. Sending and receiving little messages (~100 char) works fine. However, when I ask the GPS to dump the trails, it returns some Mbytes and here is the problem : in the stream of bytes, I randomly losts

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread Diez B. Roggisch
Michael Palmer schrieb: As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or without documentation. I've come across two projects that have the appeal of striving for simple, pythonic APIs:

Re: PyGUI as a standard GUI API for Python?

2008-09-03 Thread Diez B. Roggisch
Michael Palmer schrieb: I disagree with that. Meta-wrappers like this will always suffer from problems, as they have difficulties providing a consistent api. For example wx is said to be very windows-toolkit-centric in it's API. Yes I know that it works under Linux with GTK, but it does not come

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Diez B. Roggisch
Marco Bizzarri wrote: > Let's say I've a class a, where I can write: Anticipating this obviously premature posting: http://dirtsimple.org/2004/12/python-is-not-java.html Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: overwrite set behavior

2008-09-04 Thread Diez B. Roggisch
Michele Petrazzo wrote: > Hi all, I want to modify the method that set use for see if there is > already an object inside its obj-list. Something like this: > > class foo: pass > > bar1 = foo() > bar1.attr = 1 > > bar2 = foo() > bar2.attr = 1 > > set( (bar1, bar2), key=lambda o: o.attr) > > a

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-04 Thread Diez B. Roggisch
> Of course, I know that while I'm fresh, I've a good knowledge of the > code, and anything else, I will be able to avoid such stupid errors; > however, I'm afraid of the times when I'm tired, when I have to put my > hands on the code of someone else, and so on. > > Please, understand that I'm not

Re: Function decorators

2008-09-04 Thread Diez B. Roggisch
Aigars Aigars schrieb: Good day all, I am learning Python and came up to decorators. The question is: Why does function FoodList return value None? The code in attachment. Because the __call__ in Logger doesn't return the value of self.func. Diez -- http://mail.python.org/mailman/listinfo/p

Re: atomic section in code

2008-09-05 Thread Diez B. Roggisch
Ahmad Humayun schrieb: On Sep 5, 1:59 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: Ahmad Humayun wrote: I need to create an atomic section in Python code i.e. there is no context switch to any other thread during the running of that piece of code. Would would do the trick? use a lock, and make

Re: newbie question: how to run a python file if it is in a package

2008-09-05 Thread Diez B. Roggisch
neoedmund schrieb: for example: X.py is in aaa.bbb and it has a line like "import aaa.bbb.Y" how can I run X.py avoiding it saying such like "ImportError: No module named aaa.bbb"? Is all runnable script must be in the default package? There is no such thing as a "default package" All import

Re: Make Games

2008-09-05 Thread Diez B. Roggisch
NightZombie schrieb: x-no-archive: yes I want to learn Python so I can make simple games. What are some good books that'll help me do this? Don't know about books, but I don't think it is important that the books are about python for game programming - game programming in general will help.

Re: Understanding the pythonic way: why a.x = 1 is better than a.setX(1) ?

2008-09-05 Thread Diez B. Roggisch
Ivan Illarionov schrieb: > On 4 сент, 21:49, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: >> Ivan Illarionov a écrit : >> >> >> >>> On 4 сент, 22:59, Carl Banks <[EMAIL PROTECTED]> wrote: You can write code to guard against this if you want: class A: legal = set(["x"])

Re: PyGUI as a standard GUI API for Python?

2008-09-05 Thread Diez B. Roggisch
Peter Decker schrieb: On Wed, Sep 3, 2008 at 11:57 AM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: Michael Palmer schrieb: As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or w

Re: Files application architecture

2008-09-05 Thread Diez B. Roggisch
Benjamin Watine schrieb: Hi, I'm about to develop a small python application and I wonder how to organize files in this application. I'm familar to java, so I'm tempted to use the same convention : 1 file per class and 1 folders per package. I know that packages doesn't exists in python, the

Re: Cancel instance create

2008-09-06 Thread Diez B. Roggisch
Mohamed Yousef schrieb: ًWhat about no Constructor , and a custom instancing function that can return either None or the instance wanted That doesn't solve the underlying problem - the instance is created. Just because it wasn't *returned*, doesn't mean it isn't there. Diez -- http://mail.py

Re: embed python in ms-word?

2008-09-06 Thread Diez B. Roggisch
oyster schrieb: in fact, during my work, I often write documnets in ms-word. But the doc has many numbers in it, which need to be calculated and to be modified frequently. Is there a method to write a ms-word add-in, so that 1.I can type in the calculation steps in some program language, please

Re: How to bring subprocess to the foreground?

2008-09-06 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: Hi, I've a batch file that I open with the subprocess .Popen() . When this batch file is run I want to bring it to the foreground. Please suggest how can I do this? You can't. You can capture the stdout using the pipe-arguments, and in your main-process, read that

Re: atomic section in code

2008-09-07 Thread Diez B. Roggisch
Hendrik van Rooyen schrieb: Fredrik Lundh wrote: sounds like he wants/needs non-cooperative, mandatory locking. Could one get there using ctypes to disable interrupts? Not as such, ctypes can't execute arbitrary machine code. But of course you can create a C-lib that does what you want (I

Re: How do I set a callback in Python?

2008-09-08 Thread Diez B. Roggisch
catsclaw schrieb: I can't for the life of me figure out how to set a callback in Python. I have a class, which wraps another class. The second class needs a callback assigned. I don't want to use globals for it. Here's what I'd like to do: class MyWrapper: def get_login(self, username):

Re: Spotlight Searching in Python - Mac OSX

2008-09-08 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: Hi all, I'm having some issues getting a spotlight search to work similar to the program demonstrated here: http://pyobjc.sourceforge.net/examples/pyobjc-framework-Cocoa/AppKit/PredicateEditorSample/ Here is my class, complete with the code I am trying to use it with

Re: tracking collection modification

2008-09-08 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > On Sep 7, 8:54 pm, [EMAIL PROTECTED] wrote: >> I'm working on a remote object system, something kinda like Pyro. >> For the purposes of caching I need to be able to tell if a given >> dict / list / set has been modified. >> Ideally what I'd like is for them to have a mod

Re: Syntax Problem with strptime in Python 2.4

2008-09-08 Thread Diez B. Roggisch
W. eWatson wrote: > Apparently, use of strptime of datetime needs a workaround in Python 2.4 > to work properly. The workaround is d = > datetime.datetime(*(time.strptime(date_string, format)[0:5])). However, > when I try to use it, or even use it the regular way, it fails with > AttributeError: t

Re: XML-RPC "filter"

2008-09-09 Thread Diez B. Roggisch
Luigi wrote: > Dear all, > > I'm writing an XML-RPC server which should be able to modify the > incoming request before dispatching it. In particular I wand to added > two fixed parameters to the method called: one is the client host > address, and the other is the user name provided as for Basic

Re: I want to use a C++ library from Python

2008-09-10 Thread Diez B. Roggisch
Anders Eriksson schrieb: Hello, I have a C++ library compiled as Windows DLL's. It consists of 32 .h and 1 .lib and 1 .dll files. I don't have the source code. How can I create a Python module from these files? Did you bother googling? http://www.google.de/search?q=python+c%2B%2B&ie=utf-8&oe

Re: I want to use a C++ library from Python

2008-09-10 Thread Diez B. Roggisch
kaer wrote: > On 10 sep, 10:00, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Anders Eriksson schrieb: >> >> > Hello, >> >> > I have a C++ library compiled as Windows DLL's. It consists of 32 .h >> > and 1 .lib and 1 .dll f

Re: Adding further report options to unittest.py

2008-09-10 Thread Diez B. Roggisch
Marco Bizzarri wrote: > Hi all. > > I would like to change the way test reports are generated, in a Zope > environment. > > I'm playing with TextTestReport, TextTestRunner. Since things are > getting to complicated, I'm afraid I'm following a non-pythonic way. > > Specifically, I would like to

Re: Alternatives to traditional RDBMS

2008-09-10 Thread Diez B. Roggisch
James Mills wrote: > Hi all, > > Are there any known alternatives > to the traditional RDBMS (MySQL, > PostgreSQL, SQLite, Oracle, etc0 / > > I know of 3 written in Python: > * buzhug > * kirbybase > * PyDbLite ZODB. Without any problems usable without ZOPE, clusterable, ACID-conform and so

Re: XML-RPC "filter"

2008-09-10 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: On 9 Set, 17:55, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: I would go for a slightly different approach: make your server have a dispatch-method that delegates the calls to the underlying actual implementation. But *before* that happens, extract th

Re: formating a filesystem with python

2008-09-10 Thread Diez B. Roggisch
Ricardo Tiago schrieb: Hi all, is there a package in python that allows to mount/umount and format (to ext3) a filesystem? I know that this is possible by just calling the os commands 'mount/umount and mkfs' but this would imply to have to change sudoers to run the script as non-root. well, th

Re: formating a filesystem with python

2008-09-10 Thread Diez B. Roggisch
Ricardo Tiago schrieb: I understand that this is a very sensible unix question but i think fuse does this at least it mounts. I was wondering if there were other packages with similar functionality. I don't know what fuse is. And *mounting* can be allowed to be made by users. and possibly ther

Re: emulating read and readline methods

2008-09-10 Thread Diez B. Roggisch
Sean Davis schrieb: I have a large file that I would like to transform and then feed to a function (psycopg2 copy_from) that expects a file-like object (needs read and readline methods). I have a class like so: class GeneInfo(): def __init__(self): #urllib.urlretrieve('ftp://ftp.ncb

Re: problem with interpreter

2008-09-11 Thread Diez B. Roggisch
chusky wrote: > Hi ! > > I have Python installed on C:\Python25 > Yesterday I added new "wx" library to the Python > > when I run C:\Python25\python.exe from the command line there is a > problem with finding libraries: > > C:\Python25>python.exe > Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:4

Re: conditional install/distribution

2008-09-11 Thread Diez B. Roggisch
i3dmaster schrieb: Is there a feature in distutils or easy_install to specify what version of python that the target package can be installed? For example, if a package has a module that only needed if the python version < 2.6, is there a way to specifiy that in setup.py or easy_install cfg file

Re: Please help me finding a way to implement os.path.issubpath(a, b)

2008-09-11 Thread Diez B. Roggisch
Giampaolo Rodola' schrieb: Hi, I'm trying to implement a function which returns whether a path is a subpath of another one (e.g. /a/b/c is a subpath of /a/b). I wrote this function which apparently seems to work fine: import os def issubpath(path1, path2): """Retu

Re: handling uncaught exceptions with pdb?

2008-09-12 Thread Diez B. Roggisch
R. Bernstein schrieb: Paul Rubin writes: I think I've asked about this before, but is there a way to set up Python to handle uncaught exceptions with pdb? I know about setting sys.except_hook to something that calls pdb, but this is normally done at the outer level o

Re: Checking the boolean value of a collection

2008-09-12 Thread Diez B. Roggisch
Marco Bizzarri schrieb: Hi all. In many parts of my code I've the following schema of code: def isInUseByOutgoingRegistrations(self, archivefolder): for instance in self.findActiveOutgoingRegistrationInstances(): if instance.forbidToClose(archivefolder):

Re: Checking the boolean value of a collection

2008-09-12 Thread Diez B. Roggisch
if any(instance.forbitToClose(archivefolder) for instance in self.findActiveOutgoingRegistrationInstances()) Can you clarify where I can find "any"? It seems to me I'm unable to find it... It's part of python2.5. If you don't have that, you can write it your own and stuff it into __builtins_

Re: question about python

2008-09-13 Thread Diez B. Roggisch
fishfin schrieb: I was working through a tutorial about how to write a server using python (the url is bellow). I am sure that the server is working to some degree because when the server is running localhost:8080 just keeps trying to load until it times out. I would like to know how to send info

Re: help on python SWIG C++ extension

2008-09-16 Thread Diez B. Roggisch
RLC schrieb: Hello I am new to python SWIG. Recently I wrote a small program trying to import collada files(using colladadom) into python so I could use python cgkit to render them. However, during the progressing, I got some problems. Every time I quit from Python, I get a segmentation fault, a

Re: how to do easy_install to source code, not egg?

2008-09-18 Thread Diez B. Roggisch
dmitrey wrote: > Hi all, > how to do easy_install to source code, not egg? > > (I don't mean "develop" option, it shouldn't call compiled egg-file). $ easy_install --help --editable (-e)Install specified packages in editable form You

Re: Program works great, except under less, cron or execl (Unicode?)

2008-09-18 Thread Diez B. Roggisch
Sam wrote: > I have a program which works great when run from the command line. > > But when I run it combined with something else such as: > - piping it through less > - cron > - execl (i.e. calling it from another python program) > > it gives me a unicode error > > File "../myparser.py", lin

Re: Program works great, except under less, cron or execl (Unicode?)

2008-09-18 Thread Diez B. Roggisch
> Most probably because when to running directly inside a terminal, it gets That was of course meant to be "not running directly inside a terminal". > it's stdin/stdout as pipes - and python can't attempt to guess the proper > encoding on that, as it does on a terminal. Diez -- http://mail.pytho

Re: unicode in multi-line strings

2008-09-18 Thread Diez B. Roggisch
Jiri Barton wrote: > Hello, > > I have a problem with international characters in multi-line strings. > > > Works: '''á''' > > Works: ''' > a''' > > Does not work: ''' > á''' > > > By does not work I mean the infamous > > 'ascii' codec can't encode character u'\xe1' in position 4: ordinal

Re: How to kill threading.Thread instance?

2008-09-21 Thread Diez B. Roggisch
dmitrey schrieb: hi all, Is there a better way to kill threading.Thread (running) instance than this one http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496960 (it's all I have found via google). Nope. There might be other ways technically, but none of them falls into a "better"-class

Re: How to kill threading.Thread instance?

2008-09-21 Thread Diez B. Roggisch
dmitrey schrieb: I wonder why something like myThread.exit() or myThread.quit() or threading.kill(myThread) can't be implemented? Is something like that present in Python 3000? Not that I'm aware of it (which doesn't mean to much though). However I *am* aware of the bazillions discussions that

Re: External code and functions integration

2008-09-22 Thread Diez B. Roggisch
Cro schrieb: Good day. I am using python for quite some time now and i decided to advance a little. I want to write a little extension, or add some C modules for my python. I use Active version. What i want to do is write some wrappers for a game library, called HGE. See "hge.relishgames.com".

Re: BadStatusLine:

2008-09-22 Thread Diez B. Roggisch
noelob wrote: > Hi All, > > During performance testing of my web application, I occasionally get a > BadStatusLine exception from httplib. Reading > http://docs.python.org/lib/module-httplib.html#l2h-4021 tells me that > it's "Raised if a server responds with a HTTP status code that we > don't un

Re: Using vObject

2008-09-23 Thread Diez B. Roggisch
Joshua Gardner schrieb: I'm brand new to USENET so please bear with me. I'm writing a specialized to-do list app. I'm using Django but this is not a question about Django. It has to have recurring tasks set by the managers for the employees to then check off. I've got pretty much everything in

Re: Docstrings for class attributes

2008-09-23 Thread Diez B. Roggisch
Tom Harris wrote: > Greetings, > > I want to have a class as a container for a bunch of symbolic names > for integers, eg: > > class Constants: > FOO = 1 > BAR = 2 > > Except that I would like to attach a docstring text to the constants, > so that help(Constants.FOO) will print some arb

Re: Linq to Python

2008-09-23 Thread Diez B. Roggisch
hrishy wrote: > Hi > > Will LINQ be ported to Python ? Take a look at SQLAlchemy or SQLObject for python-based ORM/SQL-abstractions. Apart from that, python is already heavily based on concepts like iterators, filtering. Take a look at itertools. Diez -- http://mail.python.org/mailman/listinfo

Re: Folder Actions on Mac OSX Leopard?

2008-09-24 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: Greetings, I've been trying to figure out if it's possible to attach a Python script to an action via Mac OSX Leopard's File Actions system. I'm wanting to call a Python script every time a file is added to the monitored folder. Just adding a .py file doesn't seem to d

Re: is decorator the right thing to use?

2008-09-24 Thread Diez B. Roggisch
Dmitry S. Makovey schrieb: Dmitry S. Makovey wrote: In my real-life case A is a proxy to B, C and D instances/objects, not just one. forgot to mention that above would mean that I need to have more than one decorator function like AproxyB, AproxyC and AproxyD or make Aproxy smarter about

Re: Connecting to SMB share in python

2008-09-25 Thread Diez B. Roggisch
Ronnie Kwok wrote: > Thank you for the reply! > > Yes, I am running the script under linux and it will be doing some > processing before copying it over to the samba mount. > > It's totally fine to mount it with os.sys(...) approach but I am just > thinking if there's other option. None that is

Re: How to get the filename in the right case ?

2008-09-25 Thread Diez B. Roggisch
Stef Mientki wrote: > hello, > > How can I find the correct case of a filename ? > > Background in my program I use case sensitive filenames, just like > Python requires. > Now I've integrated pdb into the program, > but pdb acts somwhat strange: > upon a breakpoint it gives the filename always

Re: How to get the filename in the right case ?

2008-09-25 Thread Diez B. Roggisch
> Yes I'm pretty sure, two reasons: > 1. when I perform a step_into, jumping into a file that doesn't have > breakpoints itself (meaning my program doesn't even know of this file), > pdb returns a lowercase filename What has that to do with potential output postprocessing? > 2. rpdb2 (probably

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-25 Thread Diez B. Roggisch
Scott Sharkey schrieb: Hello all, Our development group at work seems to be heading towards adopting python as one of our standard "systems languages" for internal application development (yeah!). One of the issues that's come up is the problem with apt (deb packages) vs eggs, vs virtual env

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-25 Thread Diez B. Roggisch
Nick Craig-Wood schrieb: Scott Sharkey <[EMAIL PROTECTED]> wrote: B> Our development group at work seems to be heading towards adopting python as one of our standard "systems languages" for internal application development (yeah!). One of the issues that's come up i

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-25 Thread Diez B. Roggisch
Dmitry S. Makovey schrieb: Scott Sharkey wrote: Any insight into the best way to have a consistent, repeatable, controllable development and production environment would be much appreciated. you have just described OS package building ;) I can't speak for everybody, but supporting multiple pl

Re: PEP Proposal

2008-09-25 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: Gabriel Genellina wrote: En Thu, 25 Sep 2008 16:24:58 -0300, <[EMAIL PROTECTED]> escribió: sorry, I have these ideas for longer than 10 years, please have a look on it and comment on it. Thx. This is another proposal for introducing types into Python. You got the

Re: Eggs, VirtualEnv, and Apt - best practices?

2008-09-25 Thread Diez B. Roggisch
that is a very valid point, but it seemed that Scott has homogeneous environment: Debian/Ubuntu so my post was relative to the original request. I agree that when you throw Windows/MacOS into the mix things become "interesting". But then it's better when your developers develop on server/platform

Re: How to get the filename in the right case ?

2008-09-25 Thread Diez B. Roggisch
Stef Mientki schrieb: OKB (not okblacke) wrote: Stef Mientki wrote: import Module1 d:\data_python_25\pylab_works\module1.py(3)() -> print "hello" (Pdb) Then we know if PDB is really the culprit. So pdb is the problem. Yep, it does the same t

Event-driven framework (other than Twisted)?

2008-10-01 Thread Phillip B Oldham
Are there any python event driven frameworks other than twisted? -- http://mail.python.org/mailman/listinfo/python-list

Are there any python micro-frameworks (like ruby's Camping)?

2008-10-01 Thread Phillip B Oldham
Are there any python micro-frameworks (like ruby's Camping)? -- http://mail.python.org/mailman/listinfo/python-list

Re: Event-driven framework (other than Twisted)?

2008-10-01 Thread Phillip B Oldham
On Oct 1, 9:25 am, Lie Ryan <[EMAIL PROTECTED]> wrote: > Most GUI package use event-driven model (e.g. Tkinter). I've noticed that. I'm thinking more for a web environment (instead of MVC) or as a HTTP server. I know Twisted has TwistedWeb, but I'm looking for alternatives. -- http://mail.python.o

Re: Are there any python micro-frameworks (like ruby's Camping)?

2008-10-01 Thread Phillip B Oldham
On Oct 1, 9:53 am, Sam <[EMAIL PROTECTED]> wrote: > Did you try WebPy?http://webpy.org/Hum, the website seems to be down today Not yet - I'm hoping the python community can suggest some examples of micro/small frameworks (which just supply the basics; no forms/ templating/ORM/etc) so I can compare

Re: Are there any python micro-frameworks (like ruby's Camping)?

2008-10-01 Thread Phillip B Oldham
On Oct 1, 10:29 am, Michele Simionato <[EMAIL PROTECTED]> wrote: > How about wsgiref in the standard library? It is as small as you can > get without resorting to CGI. Interesting... I'll be sure to check that out also. Someone also mentioned Paste/WebOb, so now I have 3 to test. Any others? --

Re: Event-driven framework (other than Twisted)?

2008-10-01 Thread Phillip B Oldham
On Oct 1, 4:12 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote: > Please explain what you want to do. I'm primarily looking for alternatives to MVC frameworks for web development, particularly SAAS. I've looked around, and some whitepapers suggest that event-based frameworks often perform better tha

Re: Event-driven framework (other than Twisted)?

2008-10-01 Thread Phillip B Oldham
On Oct 1, 6:53 pm, Lie Ryan <[EMAIL PROTECTED]> wrote: > In fact, MVC and event-driven is two entirely different concept. You can > have both, or none. It is, in the end, your choice which one to use or > whether you want to use both or none. > > Event-driven programming is a concept that your prog

Re: Event-driven framework (other than Twisted)?

2008-10-02 Thread Phillip B Oldham
On Oct 2, 1:32 am, "James Mills" <[EMAIL PROTECTED]> wrote: > http://hg.shortcircuit.net.au/index.wsgi/pymills/file/b7498cd4c6a4/ex... Thanks for the example, but its not loading. -- http://mail.python.org/mailman/listinfo/python-list

Re: Event-driven framework (other than Twisted)?

2008-10-02 Thread Phillip B Oldham
On Oct 2, 1:28 am, "James Mills" <[EMAIL PROTECTED]> wrote: > Phillip, I have been developing a rather unique > event-driven and component architecture library > for quite some time that is (not twisted). Actually > it's nothing like twisted, but based on 2 core > concepts: >  * Everything is a Com

Re: Problem with lower() for unicode strings in russian

2008-10-05 Thread Diez B. Roggisch
Alexey Moskvin schrieb: Hi! I have a set of strings (all letters are capitalized) at utf-8, russian language. I need to lower it, but my_string.lower(). Doesn't work. See sample script: # -*- coding: utf-8 -*- [skip] s1 = self.title s2 = self.title.lower() print s1 == s2 returns true. I have no

Re: SAX/Python : read an xml from the end to the top

2006-03-07 Thread Diez B. Roggisch
kepioo schrieb: > I currently have an xml input file containing lots of data. My objectiv > is to write a script that reports in another xml file only the data I > am interested in. Doing this is really easy using SAX. > > The input file is continuously updated. However, the other xml file > shoul

Re: SAX/Python : read an xml from the end to the top

2006-03-07 Thread Diez B. Roggisch
> We don't want to create new output files for every entry ( each entry > is an event, and we have approximativaly 5 events per minute). So I > have to stick with this xml input file. Well, the overall amount of data won't change. But I can understand that decision. However, you might consider usi

Re: Python and Java

2006-03-07 Thread Diez B. Roggisch
JKPeck wrote: > Suppose you have an application written in Java, and you want to enable > other applications or processes written in Python to communicate with > it, i.e., to use Python as a scripting language for the application. > On Windows you could do this with COM and various addons such as

Re: inserting into a list

2006-03-07 Thread Diez B. Roggisch
John Salerno wrote: > Let me apologize in advance for what I'm sure is an achingly simple > question, but I just can't find the answer in either of my Python books. > I've tried a few tests with the interactive prompt, but they don't work > either. > > All I'm trying to do is insert an item into

Re: inserting into a list

2006-03-07 Thread Diez B. Roggisch
John Salerno wrote: > Christoph Haas wrote: > >> L[2:2]=[3] > > I'm still a little confused about this. If what I'm inserting is just an > integer, why wouldn't > L[2:2] = 3 > > work? Because a slice represents a list - even if it is a one-elemented one. So, replacing it you need another list

Re: inserting into a list

2006-03-07 Thread Diez B. Roggisch
John Salerno wrote: > Diez B. Roggisch wrote: > >> Why don't you just _try_ that? It would have been way faster than to ask >> questions you can easily answer yourself. > > I did try it, but I was still hoping for an explanation, which I've also > gotten fr

Re: [exec cmd for cmd in cmds]

2006-03-08 Thread Diez B. Roggisch
Schüle Daniel wrote: > Hello all, > > >>> p = "z%i = complex(1-1e-%i, 1-1e-%i)" > >>> lst = [p % (i,i,i) for i in range(10, 30)] > >>> for item in lst: > ... exec item > ... > >>> > >>> p = "z%i = complex(1-1e-%i, 1-1e-%i)" > >>> lst = [p % (i,i,i) for i in range(10, 30)] > >>> [exec i

Re: Type Hinting vs Type Checking and Preconditions

2006-03-08 Thread Diez B. Roggisch
Tom Bradford wrote: > This type of hinting would only break type ducking in-so-much as a > function that leveraged that hinting would be looking specifically for > an instance of a particular type, which would be absolutely no > different than a developer performing the type check manually and > t

Re: a question about zip...

2006-03-08 Thread Diez B. Roggisch
KraftDiner schrieb: > I had a structure that looked like this > ((0,1), (2, 3), (4, 5), (6,7) > > I changed my code slightly and now I do this: > odd = (1,3,5,7) > even = (0,2,4,6) > all = zip(even, odd) > > however the zip produces: > [(0, 1), (2, 3), (4, 5), (6, 7)] > > Which is a list of tupl

Re: reading float from binary data file

2006-03-08 Thread Diez B. Roggisch
cesco schrieb: > Hi, > > I have a binary file containing 1000 floating point numbers. I want to > load that file into an array. A way to do it could be the following: > import array data = array.array('f') f = open('FileName.bin', 'rb') data.fromfile(f, 1000) > > Now I have t

Weekly Python Patch/Bug Summary

2006-03-09 Thread Kurt B. Kaiser
Patch / Bug Summary ___ Patches : 386 open ( +4) / 3089 closed (+10) / 3475 total (+14) Bugs: 889 open ( +9) / 5636 closed (+12) / 6525 total (+21) RFE : 212 open ( +1) / 201 closed ( +0) / 413 total ( +1) New / Reopened Patches __ db4.4 sup

Re: Blocking a thread for x seconds

2006-03-09 Thread Diez B. Roggisch
Fernando Rodredguez wrote: > I have a class that descends from threading.Thread. One method should > block > the thread during x seconds and then call another method. How can I do > this? time.sleep(x) [*] * this comes witout any warranty about the slept time whatsoever under the assumption th

Re: implementation of "complex" type

2006-03-09 Thread Diez B. Roggisch
> Asking sarcastically why I am "reinventing the wheel" is a funny way of > being friendly. I said absolutely nothing to indicate that I had > re-implemented my own version of complex. And, by the way, even if I > had, so what? Why is it even worth commenting on? Well - obviously its not worth com

Re: Why python doesn't use syntax like function(, , x) for default parameters?

2006-03-10 Thread Diez B. Roggisch
Antoon Pardon wrote: >> >> Specifying the names of the keyword parameters costs you a little typing >> once, but saves everybody (including yourself) a lot of grief later when >> you're trying to figure out what the heck your code does 6 months later. > > Could you explain what is so hard in figu

Re: import and shared global variables

2006-03-10 Thread Diez B. Roggisch
> I'm implementing a plugin-based program, structured like the example > below (where m1 in the main module, loading m2 as a plugin). I wanted > to use a single global variable (m1.glob in the example) to store some > config data that the plugins can access. However, the output shown > belown see

Re: Python and C

2006-03-10 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > I was a C Programmer for a while. Lately started to learn Python for > one small project at school. I joined a small company where they use > C++ for development. > > Can we use Python and C together ? I mean create some classes in Python > and some number crunching alg

Re: Python and C

2006-03-10 Thread Diez B. Roggisch
> http://docs.python.org/api/api.html That should have been http://docs.python.org/ext/ext.html but you need the other one sooner or later. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Numbers in python

2006-03-10 Thread Diez B. Roggisch
> However, I can't seem to get the program to treat the numbers as > numbers. If I put them in the dictionary as 'THE' = int(0.965) the > program returns 1.0 It certainoly does _not_ return 1.0 - it returns 1. And that is all it can return for being an integer that has by definition no fractional

Re: Numbers in python

2006-03-10 Thread Diez B. Roggisch
> It certainoly does _not_ return 1.0 - it returns 1. And that is all it can > return for being an integer that has by definition no fractional part. Duncan was right of course. It returns 0. Diez -- http://mail.python.org/mailman/listinfo/python-list

<    32   33   34   35   36   37   38   39   40   41   >