Wesley Brooks wrote:
> Dear Users,
>
> I'm in the process of adding assert statements to a large piece of
> code to aid with bug hunting and came across the following issue;
>
> Using python in a terminal window you can do the following:
>
>> type(False) == bool
> True
>
> I would like to check
Nice move, using Perl/PHP for that. It's always fun to piss people off
by apologizing. ;)
Cheers,
Cliff
Dotan Cohen wrote:
> On 03/01/07, Robert Kern <[EMAIL PROTECTED]> wrote:
>> He misunderstood you (as I nearly did, too). The way you phrased
>> "decided that
>> there was no futher interest o
Jack Diederich skrev:
> On Wed, Jan 03, 2007 at 01:16:38PM -0800, Sheldon wrote:
> > I have a function that creates python objects out of C arrays and
> > returns them to Python. Below is a working example that I later want to
> > expand to return 12 arrays back to Python. The problem is that whe
Gabriel Genellina wrote:
> b=iter(a)
> for x in b:
>y=b.next()
>print x,y
>
So as not to choke on odd-length lists, you could try
a = [1,2,3,4,5,6,7]
b = iter(a)
for x in b:
try:
y=b.next()
except StopIteration:
y=None
print x,y
Substitute in whatever for y
Dear All,
I am looking for a way to create a "static object" or a "static class" -
terms might be inappropriate - having for instance:
class StaticClass:
.
.
and then
staticObject1 = StaticClass()
staticObject2 = StaticClass()
so that staticObject1 and staticObject2 refers exactly to th
That looks like some kind of singleton. Why don't you use a module
instead of a class?
Another solution is to define your data as class attributes.
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
meelab schrieb:
> Dear All,
>
> I am looking for a way to create a "static object" or a "static class" -
> terms might be inappropriate - having for instance:
>
> class StaticClass:
> .
> .
>
> and then
> staticObject1 = StaticClass()
> staticObject2 = StaticClass()
>
> so that staticOb
At Friday 29/12/2006 05:55, Scripter47 wrote:
I need a module called "pythoncom" anyone that knows where a can find
that module???
It's part of the pywin32 package
https://sourceforge.net/project/showfiles.php?group_id=78018
--
Gabriel Genellina
Softlab SRL
At Wednesday 3/1/2007 07:56, Duncan Booth wrote:
However, you really should try to separate scripts from modules otherwise
the double use as both __main__ and a named module is going to come back
and bite you.
I second this. Something with a __main__ can use (import) other
modules, but shoud
In article <[EMAIL PROTECTED]>,
meelab <[EMAIL PROTECTED]> wrote:
> Dear All,
>
> I am looking for a way to create a "static object" or a "static class" -
> terms might be inappropriate - having for instance:
>
> class StaticClass:
> .
> .
>
> and then
> staticObject1 = StaticClass()
>
At Wednesday 3/1/2007 13:21, Dotan Cohen wrote:
The first sentance under the heading "Python-list Subscribers" is:
The subscribers list is only available to the list administrator.
Admin address: Password:
As I'm not an admin, I read no further.
That page uses the default MailMan administrati
Robert Kern schreef:
> Dotan Cohen wrote:
>> On 03/01/07, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>>> Robert provided *detailed* instructions, which you ignored. I quoted
>>> the same instructions in my reply, which you also ignored. the sentence
>>> after the one where you stopped reading also
> The simplest way is to take advantage of sort-stability and do
> successive sorts. For example, to sort by a primary key ascending and
> a secondary key decending:
>
>L.sort(key=lambda r: r.secondary, reverse=True)
>L.sort(key=lambda r: r.primary)
>
Excellent! That looks just like what I
Hi Pythonistas and Pythonistos,
I am doing some fairly complex statistical analyses and trying to
display the output in a form readable to technicians not yet
enlightened by the wonders of python (ie they still use either Excel,
S-PLUS/R, or Matlab only). I need to dump the results into text such
Hi guys/gals.
I am trying to write and xml file from data parsed from a csv.
I can get everything to work except that I cannot get minidom to do -->
ö which needless to say is driving me nuts.
Any suggestions?
What it ends up doing is just removing the character from the
datastream.
--
http:/
At Wednesday 3/1/2007 13:57, Wesley Brooks wrote:
>type(b)
But the following fails:
>type(b) == classobj
Traceback (most recent call last):
File "", line 1, in ?
NameError: name 'classobj' is not defined
Do you want to test if you got a `b` class, or just for any class?
See inspect.iscla
Yes. But it still runns very slowly.
If someone is really interested in speed optimization, I can publish my
PI-calc code.
Maybe for some Python compiler/interpreter hackers... ;-)
(There are only 2 while-loops, one within another, and some simple basic
calculations. Nothing special.)
Stefan
At Wednesday 3/1/2007 19:38, meelab wrote:
I am looking for a way to create a "static object" or a "static class" -
terms might be inappropriate - having for instance:
class StaticClass:
.
.
and then
staticObject1 = StaticClass()
staticObject2 = StaticClass()
so that staticObject1 and
On 1/3/07, meelab <[EMAIL PROTECTED]> wrote:
> I am looking for a way to create a "static object" or a "static class" -
> terms might be inappropriate - having for instance:
An example will speak better than me:
class Card(object):
__cards = {}
def __init__(self, number, suit):
s
At Wednesday 3/1/2007 12:50, mm wrote:
Hmm... it's a question. It was not that easy to translate this [EMAIL PROTECTED]
C-Program into readable code and then to Python. But it works.
Because that code was written with C in mind, and uses some C
subtlecies (uhm, got it right?) obscuring the or
> If someone is really interested in speed optimization, I can publish my
> PI-calc code.
I wouldn't mind seeing it. Chances are you will get much better help if
you post your code anyway.
-Matt
--
http://mail.python.org/mailman/listinfo/python-list
How are Python users dealing with some of the new OASIS Open Document
formats (Open Office) or MS Open XML formats. These formats store data
in a file which is actual a zip archive that contains numerous files and
folders. For example, a file saved from Open Office 2.0 named 'test.odt'
can be u
Ok, here is the code. It is a translation of the following code, found
on the internet.
* The C is very fast, Python not.
* Target: Do optimization, that Python runs nearly like C.
Auf 800 Stellen in 160 Zeichen...
--
int a=1,b,c=2800,d,e,f[2801],g;main(){for(;b-c;)f[b++]=a/5;
for
dwelden wrote:
> >L.sort(key=lambda r: r.secondary, reverse=True)
> >L.sort(key=lambda r: r.primary)
> Excellent! That looks just like what I needed.
Note that there is the (probably little used) operator.attrgetter()
too, with that you can avoid the possibly slow lambda:
L.sort(key=attrge
meelab <[EMAIL PROTECTED]> writes:
> In other words, that is a class which would result in only 1 instance
> always the same no matter how many times I will "instantiate" it.
The "Singleton" pattern does what you say here. Implementing a proper
Singleton in Python is complicated and hard to under
>
> I think that it *is* possible to do it, but a whole lot of work had to
> be done to achieve this. It is all about how many rules (like how to
> convert this block of unreadable code of language X into a readable
> python block) you are willing to find/program (and these are a lot). It
> is a
At Wednesday 3/1/2007 22:10, Michael M. wrote:
Ok, here is the code. It is a translation of the following code, found
on the internet.
* The C is very fast, Python not.
* Target: Do optimization, that Python runs nearly like C.
Why? Python is strong in other aspects, *not* on computation spee
Michael M.:
> * The C is very fast, Python not.
> * Target: Do optimization, that Python runs nearly like C.
Python can't be fast as C for that kind of programs.
Note that your original C program gives less digits than the Python
program.
Your original takes about ~15.2 s on my PC. The following v
I find that I can often live with a 0-60 sec. pause. and set command in
a queue like
then have a cron that runs once a min as the user you need to run this
on
that looks at the queue and sees if there are any pending
I often use a sql database for this
--
http://mail.python.org/mailman/listinfo
Martin v. Löwis wrote:
> Paul Watson schrieb:
>> ./configure
>> make
>> make test
>>
>> The result appears to hang after the test_tkl... line. I had to kill
>> the 'make test' process which terminated it. Any suggestions?
>
> There isn't (or shouldn't be) any "test_tkl..." line. What precisely
>
Jeffrey Froman wrote:
> Dave Dean wrote:
>
> > I'm looking for a way to iterate through a list, two (or more) items at a
> > time.
>
> Here's a solution, from the iterools documentation. It may not be the /most/
> beautiful, but it is short, and scales well for larger groupings:
>
> >>> from iter
Announcing Urwid 0.9.7.2
Urwid home page:
http://excess.org/urwid/
Tarball:
http://excess.org/urwid/urwid-0.9.7.2.tar.gz
About this release:
===
This maintenance release significantly improves the performance of
Urwid when run in UTF-8 mode. A UT
Paul Watson wrote:
> Martin v. Löwis wrote:
> > Paul Watson schrieb:
> >> ./configure
> >> make
> >> make test
> >>
> >> The result appears to hang after the test_tkl... line. I had to kill
> >> the 'make test' process which terminated it. Any suggestions?
> >
>
> Sorry, I mis-typed. It is not
On Thu, 04 Jan 2007 02:10:44 +0100, Michael M. wrote:
> print "\nTiming a 1 million loop 'for loop' ..."
> start = time.clock()
> for x in range(100):
>y = x # do something
Why not "pass # do nothing"?
> end = time.clock()
> print "Time elapsed = ", end - start, "seconds"
Are you awar
On 03/01/07, Jan Dries <[EMAIL PROTECTED]> wrote:
> Dotan Cohen wrote:
> > On 03/01/07, Robert Kern <[EMAIL PROTECTED]> wrote:
> >> He misunderstood you (as I nearly did, too). The way you phrased "decided
> >> that
> >> there was no futher interest on the page for me" is somewhat ambiguous: it
>
Hello group,
Is there a separate mailing list for comtypes? Or this is the
appropriate place to post questions related to this package(from Thomas
Heller)?
Thanks,
--
wcc
--
http://mail.python.org/mailman/listinfo/python-list
tubby wrote:
> How are Python users dealing with some of the new OASIS Open Document
> formats (Open Office) or MS Open XML formats. These formats store data
> in a file which is actual a zip archive that contains numerous files and
> folders. For example, a file saved from Open Office 2.0 name
Counter-surveillance sweep by Nationwide Investigations Group
In July 1994 the private detective agency Nationwide Investigations Group
conducted an electronic counter-surveillance
sweep of my parents' home in London. They checked for radio transmitter
devices, and tested the telephone line for
Hello,
How do I create a class using a variable as the class name?
For example, in the code below, I'd like replace the line
class TestClass(object):
with something like
class eval(className) (object):
Is it possible? Thanks for your help.
className = "TestClass"
class TestClass(object):
You can always rename your defined clas afterwards
class TestClass:
pass
myClass = TestClass
--
Tõnis
On Jan 4, 9:27 am, "wcc" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> How do I create a class using a variable as the class name?
>
> For example, in the code below, I'd like replace the line
>
>As I said above, I don't know very much
> about these things, so I can't comment on the capabilities or otherwise of
> this equipment. >But clearly the "watchers" are using
> technology which in 1994 was beyond the detection capabilities of a good
> private detective >agency.
>
Lisp did that 20
Or if you have required class name in variable, then use:
class TestClass:
pass
globals()[className] = TestClass
--
Tõnis
On Jan 4, 9:27 am, "wcc" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> How do I create a class using a variable as the class name?
>
> For example, in the code below, I'd like
Michael M. wrote:
> Ok, here is the code. It is a translation of the following code, found
> on the internet.
>
> * The C is very fast, Python not.
> * Target: Do optimization, that Python runs nearly like C.
There is an error in the translated code. It returns 1600 digits
instead of 800 digits.
In <[EMAIL PROTECTED]>, Michael M. wrote:
> * The C is very fast, Python not.
> * Target: Do optimization, that Python runs nearly like C.
As someone else already asked: Why? You can't beat a compiled to machine
code language with an interpreted one when doing integer arithmetic.
> counter=c
>
101 - 144 of 144 matches
Mail list logo