I think you should implement it as a C extension and/or write a PEP.
This has been an unfilled need in Python for a while (SF RFE 467384).
I've submitted a proto PEP to python-dev. It coming up against many of
the same objections to the RFE.
Sw.
--
[EMAIL PROTECTED] writes:
I think you should implement it as a C extension and/or write a PEP.
This has been an unfilled need in Python for a while (SF RFE 467384).
I've submitted a proto PEP to python-dev. It coming up against many of
the same objections to the RFE.
See also bug# 471893
[EMAIL PROTECTED] wrote:
Well, I'm a total python n00b, but I was playing around with exception
handling
yesterday, and was stricken by how incredibly easy it is to use the op system
to create nice scripts... I did the following:
import sys
lines = sys.stdin.readlines()
lines.sort()
for stuff
Hello All,
I'm trying to embed Python in a C application.
What I didn't find is how to create an instance once I have a class object.
I'd like to do the equivalent of:
from a import A
obj = A()
obj.foo(10)
The following code omits error checking for clarity.
--- a.py ---
class A:
See also bug# 471893 where jhylton suggests a PEP. Something really
ought to be done about this.
I know this, you know this... I don't understand why the suggestion is
meeting so much resistance. This is something I needed for a real world
system which moves lots of data around to untrusted
Casey Hawthorne [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
What platforms have Python Virtual Machines and what version(s) of
Python do they support?
In particular:
Palm OS
PocketPC
Try using Google (Python PocketPC, for instance) or the equivalent
TJR
--
http://dmoz.org/Computers/Programming/Languages/Python/Ports/
--
http://mail.python.org/mailman/listinfo/python-list
Peter Hansen wrote:
Michael, tai64nlocal is a program that converts a special packed
timestamp to human-readable form.
Thanks Peter. I was asking somewhat rhetorically but I have a love of
UNIX arcana and now I know. :)
--
Michael Hoffman
--
John Roth wrote:
you need _both_ isinstance and the types module to do a correct
check for any string type: isinstance(fubar, types.StringTypes).
That's because both string and unicode are subtypes of one base.
But basestring, their base class is a built-in.
--
Michael Hoffman
--
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/299271
or the nice recipe, page 403 of cookbook2, that i can't find in ASPN
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
[snip..]
results. Now, I was thinking today, I'd really like to create a program that
can go to a specific directory and upload all the files in the directory to a
specific url for backup purposes, and I have the feeling that the python
implementation would be
Martin Blume [EMAIL PROTECTED] writes:
A great analysis, but what's a pogo stick and where can I get one?
http://search.ebay.com/pogo-stick
--
Bjrn Lindstrm [EMAIL PROTECTED]
Student of computational linguistics, Uppsala University, Sweden
--
[EMAIL PROTECTED], Bo Peng [EMAIL PROTECTED] wrote:
I have around 10 of them. Using these if/else, it will take 50 lines for
a function call. It also bothers me to have 10 variables left in the
namespace, in addition to finding 10 meaningful names.
If you've got 10 different conditional
Bjrn Lindstrm schrieb
A great analysis, but what's a pogo stick and where can I get
one?
http://search.ebay.com/pogo-stick
Yes, that explains the bouncing with the pogo stick; I would have
poked around
with a stick.
ROTFL, thank you.
Martin
--
Hmmm... the page is a *bit* out of date (which is to be expected I
suppose).
There is a port of Python 2.3 for Pocket PC.
I think pippy is pretty dead and wasn't that useable. On this newsgroup
not long ago someone announced they were working on a new PalmOS port.
To the best of my knowledge
If anyone is interested, I've implemented a faster and more space
efficient gherkin with a few bug fixes.
http://developer.berlios.de/project/showfiles.php?group_id=2847
--
http://mail.python.org/mailman/listinfo/python-list
If your test variable has specific values to branch on, the standard
way is to have those values be keys in a dictionary, and do:
branched_func_obj = dict_of_values.get(testvar)
And the lambda hack is here, courtesy of Peter Norvig
http://www.norvig.com/python-iaq.html
--
In this case I have used hasattr(obj, __iter__) instead of
isinstance(obj, list)
(strings are iterable but do not have __iter__ method). I think hasattr
is much better
since it works for tuples and custom iterables too.
Michele Simionato
--
On 2005-06-18, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
How are the development tools for the Mac? I'll use IDLE if it's
available, but I like Scintilla better.
Idle is
/System/Library/Frameworks/Python.framework/Versions/2.3/bin/idle
First thing you want to do is install readline to make
On 2005-06-17, rh0dium [EMAIL PROTECTED] wrote:
I am starting to play with pysqlite, and would like to know if there is
a function to determine if a table exists or not.
sqlite_master has already been mentioned, so I'll point out some useful
pragmas (under Pragmas to query the database
Roy Smith wrote:
Can you give us some idea of what it is that you're trying to do? It pretty
unusual to see
a requirement like that.
def func(type_of_obj1, type_of_obj2, .):
callfunc( [
type_of_obj1 and obj1a() or obj1b(),
type_of_obj2 and obj2a() or obj2b(),
On 2005-06-18, cpunerd4 [EMAIL PROTECTED] wrote:
thanks all for the advice. The reason I was thinking about using java
(or C or something) was that it is a little more secure than
distributing the source code isn't it?
sigh 14 and he already wants to horde his source code.
Dave Cook
--
In article [EMAIL PROTECTED], Bo Peng [EMAIL PROTECTED] wrote:
Roy Smith wrote:
Can you give us some idea of what it is that you're trying to do? It
pretty unusual to see
a requirement like that.
def func(type_of_obj1, type_of_obj2, .):
callfunc( [
type_of_obj1 and
Kent Johnson wrote:
letters = {}
for letter in ascii_lowercase:
letters[letter] = 0
Or more simply:
letters = dict.fromkeys(ascii_lowercase, 0)
--
http://mail.python.org/mailman/listinfo/python-list
On 2005-06-18, cpunerd4 [EMAIL PROTECTED] wrote:
I see your point, although I don't think there is much a 14 year old
can do to sue someone. . . I'm sure my code won't be that valuable
untill I'm older though. Thanks
It's valuable as something to show prospective employers or clients: I wrote
Bo Peng wrote:
Roy Smith wrote:
Can you give us some idea of what it is that you're trying to do? It
pretty unusual to see
a requirement like that.
def func(type_of_obj1, type_of_obj2, .):
callfunc( [
type_of_obj1 and obj1a() or obj1b(),
type_of_obj2 and obj2a() or
Dave Cook wrote:
On 2005-06-18, cpunerd4 [EMAIL PROTECTED] wrote:
thanks all for the advice. The reason I was thinking about using java
(or C or something) was that it is a little more secure than
distributing the source code isn't it?
sigh 14 and he already wants to horde his source code.
Michele Simionato wrote:
In this case I have used hasattr(obj, __iter__) instead of
isinstance(obj, list)
(strings are iterable but do not have __iter__ method). I think hasattr
is much better
since it works for tuples and custom iterables too.
The fact that strings don't have __iter__ is
McBooCzech [EMAIL PROTECTED] wrote:
sorry for bothering you with my comment. From my point of view, the
situation on the IDE (GUI??) development field for Python is really
strange. Just try to imagine the same situation around the Python.
Plenty of different approaches, versions, philosophies
I think strings do not have __iter__ on purpose, exactly to distinguish
them
from other iterables, since sometimes it is nice to consider them
atomic,
but I am not sure of this. You should ask the developers. Anyway, the
right definition of iterable is (as I was told) an object X such that
iter(X)
Michele Simionato wrote:
I think strings do not have __iter__ on purpose, exactly to distinguish
them from other iterables, since sometimes it is nice to consider them
atomic, but I am not sure of this. You should ask the developers. Anyway, the
right definition of iterable is (as I was told)
Bo Peng wrote:
Roy Smith wrote:
Can you give us some idea of what it is that you're trying to do? It
pretty unusual to see a requirement like that.
def func(type_of_obj1, type_of_obj2, .):
callfunc( [
type_of_obj1 and obj1a() or obj1b(),
type_of_obj2 and obj2a() or
Hello,
I have python code which use tab=2. Recently I would like to change it
into tab=4.
Anyone has suggestion to convert easily and safely ?
pujo
--
http://mail.python.org/mailman/listinfo/python-list
George Sakkis [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Michele Simionato wrote:
I think strings do not have __iter__ on purpose, exactly to distinguish
them from other iterables, since sometimes it is nice to consider them
atomic, but I am not sure of this. You should ask the
John Roth wrote:
Unfortunately it doesn't work: getitem can be defined for
a class that acts like a dictionary: that is, the items are
not integers, let alone integers that extend in a strict
sequence from 0.
This is true, but that's the current behaviour of iterators for classes
that define
[EMAIL PROTECTED] schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
| Hello,
|
| I have python code which use tab=2. Recently I would like to change it
| into tab=4.
|
| Anyone has suggestion to convert easily and safely ?
Look at reindent.py in Tools\Scripts.
--
Vincent Wehren
|
| pujo
|
--
Fuzzyman wrote:
To the best of my knowledge jython is languishing at Python 2.1. The
PSF has funded a push to implement new style classes which will allow
it to be brought up to date.
It's really not languishing any more. There is a lot of activity spearheaded by
Brian Zimmer (who received
[EMAIL PROTECTED] writes:
See also bug# 471893 where jhylton suggests a PEP. Something really
ought to be done about this.
I know this, you know this... I don't understand why the suggestion is
meeting so much resistance. This is something I needed for a real world
system which moves
Hello everyone and thank you for being such a good community.
Anyway, I was wondering...I have an super class which is the superclass
for 5 other classes. However, I want to be able to call the subclass
constructors from the super class. Is this possible?
Thank you in advance
--
Thanks it works!
pujo
--
http://mail.python.org/mailman/listinfo/python-list
In Han Kang wrote:
Hello everyone and thank you for being such a good community.
Anyway, I was wondering...I have an super class which is the superclass
for 5 other classes. However, I want to be able to call the subclass
constructors from the super class. Is this possible?
If you have
oops... it is in the tutorial... sorry.
though, where would one find it in the python reference?
i.e. the function def with variable/default parameters.
This is not a rhetorical question, but where would one start to look
for it in the python ref?
a language is used by programers. Subroutine
[EMAIL PROTECTED] writes:
If anyone is interested, I've implemented a faster and more space
efficient gherkin with a few bug fixes.
It would be nice if you just posted the PEP.
--
http://mail.python.org/mailman/listinfo/python-list
No. You will go into an infinite loop - at least I get there when I try
someting like this:
class Base:
def __init__(self):
Derived.__init__(self)
print 'Base'
class Derived(Base):
def __init__(self):
Base.__init__(self)
Xah Lee wrote:
oops... it is in the tutorial... sorry.
though, where would one find it in the python reference?
i.e. the function def with variable/default parameters.
This is not a rhetorical question, but where would one start to look
for it in the python ref?
Oddly enough,
in coding Python yesterday, i was quite stung by the fact that lists
appened to another list goes by as some so-called reference. e.g.
t=range(5)
n=range(3)
n[0]='m'
t.append(n)
n[0]='h'
t.append(n)
print t
in the following code, after some 1 hour, finally i found the solution
of h[:]. (and
Xah Lee wrote:
oops... it is in the tutorial... sorry.
though, where would one find it in the python reference?
i.e. the function def with variable/default parameters.
This is not a rhetorical question, but where would one start to look
for it in the python ref?
a language is used by
In hindsight analysis, such language behavior forces the programer to
fuse mathematical or algorithmic ideas with implementation details. A
easy way to see this, is to ask yourself: how come in mathematics
there's no such thing as addresses/pointers/references.
Mathematics also has no
In Han Kang wrote:
Anyway, I was wondering...I have an super class which is the superclass
for 5 other classes. However, I want to be able to call the subclass
constructors from the super class. Is this possible?
Are you trying to use your superclass as a factory?
If so, one option is
So each of the sub classes plots a different type of graph. The
superclass defines methods that are the same for all the plots. I want
to be able to pick some points and be able to generate a more plots.
What I was wondering if I could define in a method in the superclass of
an object the
Xah said unto the world:
oops... it is in the tutorial... sorry.
though, where would one find it in the python reference?
i.e. the function def with variable/default parameters.
This is not a rhetorical question, but where would one start to look
for it in the python ref?
a language is used by
Peter Hansen wrote:
D H wrote:
So you say he has done relatively little serious development and
that he may not even know about Python. I didn't see any evidence
from those pages to draw either conclusion. In fact the 4th paragraph
quite contradicts them both.
Clearly this is a
Hi,
I am trying to login a website that using PHP and javascript. This is
what happend if you browse that website using IE, after you login, you
can go anywhere without enter your name and password again, as long as
you keep that IE open, but after you close that IE, then later on open
that
Peter Hansen wrote:
D H wrote:
Peter Hansen wrote:
[some stuff Doug didn't like]
Actually, this is what you snipped, stuff you didn't like, because the
very mention of boo causes you such fits:
Since you and Steve Holden agree that a case statement is useful, why
don't you propose
Peter Hansen wrote:
Bo Peng wrote:
I need to pass a bunch of parameters conditionally. In C/C++, I can do
func(cond1?a:b,cond2?c:d,.)
Is there an easier way to do this in Python?
Please read the FAQ to learn the answer and much other useful ...
The answer is no. Use if
Joseph Garvin wrote:
Peter Otten wrote:
I found 136 occurrences of do { versus 754 of while ( and 1224 of
for
( in the Python 2.4 source, so using these rough estimates do-while
still
qualifies as rarely used.
Peter
That's 136 times you'd have to use an ugly hack instead. I
You should be able to access regular dlls and handle callbacks with
the ctypes module without needing to resort to any real c code:
http://starship.python.net/crew/theller/ctypes/
-Chris
On 18 Jun 2005 02:10:59 -0700, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Hi together,
i have a Windows
In Han Kang wrote:
So each of the sub classes plots a different type of graph. The
superclass defines methods that are the same for all the plots. I want
to be able to pick some points and be able to generate a more plots.
What I was wondering if I could define in a method in the
On Saturday 18 June 2005 10:35 pm, James Carroll wrote:
Hi, I'm creating an extension called _bright.so on linux. I can
import it with import _bright, but how can I import bright and get the
package?
On windows, I've been able to import bright instead of import _bright,
but on Linux it
I think the only reason I read your posts is for comedy, seeing if this
is yet another Xah Lee just threw a tantrum post. I don't know why
I'm wasting my time responding, though... It's against my better
judgment and my previous advice to the group.
Xah Lee wrote:
in coding Python
On Sunday 19 June 2005 05:34 pm, Xah Lee wrote:
in coding Python yesterday, i was quite stung by the fact that lists
appened to another list goes by as some so-called reference. e.g.
t=range(5)
n=range(3)
n[0]='m'
t.append(n)
n[0]='h'
t.append(n)
print t
Day one in learning Python, yes
#!/usr/bin/env python
# Using a print statement to stdout results in an
# unwanted space character being generated at the
# end of each print output. Same results on
# DOS/Windows and AIX.
#
# I need precise control over the bytes that are
# produced. Why is print doing this?
#
...it's this last one that causes the problem. In the real code, the
call to type.__setattr__ referred to above seems to lead to a call to
something like cls.__base__.__dict__[attr].__set__(cls, value).
Uhm ... sounds right, but I a bit confused. Could you please give us a
doctest showing us what
Don't use print, write directly to sys.stdout.
Print is not intended for precise output formatting;
it's intended for quick outputs that are useable
most of the time.
John Roth
Paul Watson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
#!/usr/bin/env python
# Using a print
wxDesigner + XRCed = The best.
I would like the Boa approach but with xrc exports. It would
reaally be the best of the best!
And don't get me wrong too, but to be better than the competition you
need to be better than the competition - Christoph Rackwitz
Daniel
--
On 6/18/05, D H [EMAIL PROTECTED] wrote:
I would hardly call using a
dictionary as a switch statement, the equivalent. The fact that
people use a dictionary as a conditional is a python wart.
Not at all. A case statement is nothing more than a literal mapping of
constant values to the
In article [EMAIL PROTECTED],
Xah Lee [EMAIL PROTECTED] wrote:
A[n] easy way to see this, is to ask yourself: how come in mathematics
there's no such thing as addresses/pointers/references.
Yes there are such things in mathematics, though not necessarily under
that name.
For instance, in
67 matches
Mail list logo