"Chris Mellon" <[EMAIL PROTECTED]> writes:
> On 09 Oct 2007 17:20:09 +0200, Stefan Arentz <[EMAIL PROTECTED]> wrote:
> >
> > Is there an easy way to implement a specific method of a Python class
> > in C? Like a native method in Java? I would really like
Is there an easy way to implement a specific method of a Python class
in C? Like a native method in Java? I would really like to do the
majority of my class code in Python and just do one or two methods
in C.
S.
--
http://mail.python.org/mailman/listinfo/python-list
Is it possible to mix classes defined in both Python and C in the same
module? Ideally I would like to be able to do:
from some.module import MyPythonClass, MyCClass
I guess that would mean that this would look like this on disk:
some/
__init__.py
module.py (contains MyPythonClass)
At http://docs.python.org/dist/node12.html it is described how to add
package data to a module. This was pretty easy to do, but now how do I
access this data from my module? Is there an API to load a 'package
resource' ala Java's classloader?
S.
--
http://mail.python.org/mailman/listinfo/python
Stefan Arentz <[EMAIL PROTECTED]> writes:
> Is there a better way to do the following?
>
> attributes = ['foo', 'bar']
>
> attributeNames = {}
> n = 1
> for attribute in attributes:
>attributeNames["AttributeName.%d" % n] = attribu
Is there a better way to do the following?
attributes = ['foo', 'bar']
attributeNames = {}
n = 1
for attribute in attributes:
attributeNames["AttributeName.%d" % n] = attribute
n = n + 1
It works, but I am wondering if there is a more pythonic way to
do this.
S.
--
http://mail.python.o
[EMAIL PROTECTED] (Alex Martelli) writes:
> Stefan Arentz <[EMAIL PROTECTED]> wrote:
>
> > Miki <[EMAIL PROTECTED]> writes:
> >
> > > > steps.sort(key = lambda s: s.time)
> > > This is why attrgetter in the operator module
Miki <[EMAIL PROTECTED]> writes:
> > steps.sort(key = lambda s: s.time)
> This is why attrgetter in the operator module was invented.
> from operator import attrgetter
> ...
> steps.sort(key=attrgettr("time"))
Personally I prefer the anonymous function over attrgettr :)
S.
--
http://mail.pyt
[EMAIL PROTECTED] writes:
> Hi there
>
> I am fairly new to Python and have not really used regular expressions
> before (I think this might be needed for my query) and wondered if you
> could help
>
> I have a step class and store in a list step instances
> A step instance contains variables: n
Michele Simionato <[EMAIL PROTECTED]> writes:
> On Sep 5, 9:54 pm, MarkyMarc <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I want to make a web service application in python and keywords are
> > RESTful, python and nice urls(urls mapped to python objects).
> >
> > I don't want a big framework but
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
> On Thu, 06 Sep 2007 09:00:02 +0200, Stefan Arentz wrote:
>
> > What I find really frustrating in Python (combined with usually bad
> > documentation) is that many people have different styles. The most
>
Bruno Desthuilliers <[EMAIL PROTECTED]> writes:
...
> The problem with Java is that it makes it very painfull to bridge two
> APIs together, while Python usually makes it a breeze (easy
> delegation, no dumb-ass psycho-rigid type system). So Java's solution
> (hyper-formalization) isn't necessary
Is there a JMS-like API available for Python? I would like to
quickly receive messages through the network and then process
those slowly in the backgound. In the Java world I would simply
create a (persistent) queue and tell the JSM provider to run
N messagehandlers parallel.
Is something like th
"Fcamattti" <[EMAIL PROTECTED]> writes:
> Hello for everybody
OH MY GOD!?!?!?!?!?!?! I BETTER FIND A NEW JOB!?!?!?!?
S.
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin <http://[EMAIL PROTECTED]> writes:
> Stefan Arentz <[EMAIL PROTECTED]> writes:
> > > Would it be too much to ask that in a line like.
> > > x = x + 1.
> > > both x's would resolve to the same namespace?
> > ...
> > Co
Antoon Pardon <[EMAIL PROTECTED]> writes:
> Op 2005-11-03, Mike Meyer schreef <[EMAIL PROTECTED]>:
> > Antoon Pardon <[EMAIL PROTECTED]> writes:
> >>> What would you expect to get if you wrote b.a = b.a + 2?
> >> I would expect a result consistent with the fact that both times
> >> b.a would refer
Antoon Pardon <[EMAIL PROTECTED]> writes:
...
> Would it be too much to ask that in a line like.
>
> x = x + 1.
>
> both x's would resolve to the same namespace?
This is starting to look more like a nagging contest than a real
discussion imo.
Consider changing the semantics of what you are
Antoon Pardon <[EMAIL PROTECTED]> writes:
...
> > Ah yes. Well, good luck with that. You seem to have decided that it is not
> > sane and who am I to argue with that. It depends on your state of mind :-)
>
> I can just say the opposite, that you seem to have decided that it is
> sane.
I have. I
Antoon Pardon <[EMAIL PROTECTED]> writes:
> Op 2005-11-03, Stefan Arentz schreef <[EMAIL PROTECTED]>:
> > Antoon Pardon <[EMAIL PROTECTED]> writes:
> >
> > ...
> >
> >> Fine, we have the code:
> >>
> >> b.a += 2
>
Stefan Arentz <[EMAIL PROTECTED]> writes:
> Antoon Pardon <[EMAIL PROTECTED]> writes:
>
> ...
>
> > Fine, we have the code:
> >
> > b.a += 2
> >
> > We found the class variable, because there is no instance variable,
> &g
Antoon Pardon <[EMAIL PROTECTED]> writes:
...
> Fine, we have the code:
>
> b.a += 2
>
> We found the class variable, because there is no instance variable,
> then why is the class variable not incremented by two now?
Because it really is executed as:
b.a = b.a + 2
1. get 't'b.a and sto
Antoon Pardon <[EMAIL PROTECTED]> writes:
> Op 2005-11-03, venk schreef <[EMAIL PROTECTED]>:
> > You see,
> > The seen behavior is due to the result of python's name
> > binding,scoping scheme.
>
> I know what causes the behaviour. But I still think it is
> not sane behaviour.
>
>
> > ...
Antoon Pardon <[EMAIL PROTECTED]> writes:
...
> >> No matter wat the OO model is, I don't think the following code
> >> exhibits sane behaviour:
> >>
> >> class A:
> >> a = 1
> >>
> >> b = A()
> >> b.a += 2
> >> print b.a
> >> print A.a
> >>
> >> Which results in
> >>
> >> 3
> >> 1
> >
> >
Stuart Turner <[EMAIL PROTECTED]> writes:
> I'm already using it for a ton of things - I want to try and get broader
> acceptance in the organisation for it to be made and 'officially supported
> product'.
IMO that is what you need to communicate: 'already using it for a ton of
things' and probab
Stuart Turner <[EMAIL PROTECTED]> writes:
> Hi Everyone,
>
> I'm working hard trying to get Python 'accepted' in the organisation I work
> for. I'm making some good in-roads. One chap sent me the text below on
> his views of Python. I wondered if anyone from the group could give me
> some advi
Antoon Pardon <[EMAIL PROTECTED]> writes:
> Op 2005-11-03, Steven D'Aprano schreef <[EMAIL PROTECTED]>:
>
> >> There are two possible fixes, either by prohibiting instance variables
> >> with the same name as class variables, which would allow any reference
> >> to an instance of the class assign
"hungbichvo" <[EMAIL PROTECTED]> writes:
> Dear All,
>
> My python application is small. It reads data from a file.
> My code is:
>fileName = '900128.DAT'
>dataFile = open(fileName, 'r').readlines()
> I have to run 100 input files .DAT. Each time I run application, I have
> to change cod
Hi. I've wrapped a C++ class with Boost.Python and that works great. But, I
am now packaging my application so that it can be distributed. The structure
is basically this:
.../bin/foo.py
.../lib/foo.so
.../lib/bar.py
In foo.py I do the following:
sys.path.append(os.path.dirname(sys.path[0])
Howdy.
I'm looking at embedding python in a little embedded system. The device
(a linksys wrt54g router, popular hack object since it runs linux), has
limited resources. Just 4MB flash and 16MB memory.
I'm interested in Python because I need to be more agile with developing
an application for th
29 matches
Mail list logo