"John" <[EMAIL PROTECTED]> wrote:
>
>How do I find out the cache line length of a machine in python?
How would that piece of information be valuable in Python? There isn't
anything you can do to take advantage of it in Python.
You can look up the L2 and L3 cache size and speed using WMI (assumin
Fredrik Lundh wrote:
> [EMAIL PROTECTED] wrote:
>
> > I have googled hard, and did see someone asking the same question, but
> > haven't found a good solution to this problem. Could anyone give me a
> > hint? Thanks a lot!
>
> googling for "undefined symbol: __pure_virtual" brings up hundreds of
In message <[EMAIL PROTECTED]>, Piet van Oostrum wrote:
> The scenario is as follows: Suppose the script starts with the line:
> #!/usr/bin/python
>
> (using #!/usr/bin/env python would be disastrous because the user could
> supply his own `python interpreter' in his PATH.)
>
> Now a malicious u
[EMAIL PROTECTED] wrote:
> I have googled hard, and did see someone asking the same question, but
> haven't found a good solution to this problem. Could anyone give me a
> hint? Thanks a lot!
googling for "undefined symbol: __pure_virtual" brings up hundreds of
posts on this topic, and the ans
In message <[EMAIL PROTECTED]>, Paul
Hummer wrote:
> I learned PHP for ease of web application development ...
PHP is great for easily developing _insecure_ web applications. But if you
want them not to leak like a sieve, things get a bit more complicated.
--
http://mail.python.org/mailman/listi
In message <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
> [3] I thought it was particularly cool how Tcl could bolt on a class
> based object oriented system as a library. The word "class" isn't
> built into the language, but that kind of evaluator lets you add it.
I have written about two notr
belinda thom wrote:
> On Jan 4, 2007, at 9:28 PM, Carl Banks wrote:
>
> > jeremito wrote:
> >> I am writing a class that is intended to be subclassed. What is the
> >> proper way to indicate that a sub class must override a method?
> >
> > You can't (easily).
> >
> > If your subclass doesn't ove
belinda thom wrote:
> I imagine the NotImplementedError is actually a defined object, but I
> really don't know.
It is.
> So, back to my question: is a catalog of standard python errors
> available? I've looked on the python site but had no success.
http://docs.python.org/lib/module-excepti
On Jan 4, 11:57 pm, belinda thom <[EMAIL PROTECTED]> wrote:
...
> So, back to my question: is a catalog of standard python errors
> available? I've looked on the python site but had no success.
>>> [name for name in dir(__builtins__) if name.endswith('Error')]
['ArithmeticError', 'AssertionError',
I downloaded MySQL-python-1.2.1 from SourceForge and installed it on a
Mandrake system (Mandrake Linux 9.2 3.3.1-2mdk on linux2).
The installation was successful. The gcc version is 3.3.
My Python version is 2.4.2. When I import MySQLdb, I get an error
which says that __pure_virtual is an undef
On Jan 4, 2007, at 9:28 PM, Carl Banks wrote:
> jeremito wrote:
>> I am writing a class that is intended to be subclassed. What is the
>> proper way to indicate that a sub class must override a method?
>
> You can't (easily).
>
> If your subclass doesn't override a method, then you'll get a big
On Jan 4, 2007, at 7:56 PM, Thomas Ploch wrote:
> Gabriel Genellina schrieb:
>> At Thursday 4/1/2007 23:52, jeremito wrote:
>>
>>> I am writing a class that is intended to be subclassed. What is the
>>> proper way to indicate that a sub class must override a method?
>>
>> If any subclass *must*
On 2007-01-05, Thomas Ploch <[EMAIL PROTECTED]> wrote:
>>> I learn so much from this list. I didn't even know this error
>>> existed.
>>
>> And remember: even if it didn't, you could have created your
>> own:
>
> Erm, it wasn't me who asked. I just wanted to say that I didn't know
> that there is
jeremito wrote:
> I am writing a class that is intended to be subclassed. What is the
> proper way to indicate that a sub class must override a method?
You can't (easily).
If your subclass doesn't override a method, then you'll get a big fat
AttributeError when someone tries to call it. But thi
Grant Edwards schrieb:
> On 2007-01-05, Thomas Ploch <[EMAIL PROTECTED]> wrote:
>
I am writing a class that is intended to be subclassed. What
is the proper way to indicate that a sub class must override a
method?
>>> If any subclass *must* override a method, raise
>>> NotImplement
On 2007-01-05, Thomas Ploch <[EMAIL PROTECTED]> wrote:
>>> I am writing a class that is intended to be subclassed. What
>>> is the proper way to indicate that a sub class must override a
>>> method?
>>
>> If any subclass *must* override a method, raise
>> NotImplementedError in the base class (a
Gabriel Genellina wrote:
> At Thursday 4/1/2007 23:52, jeremito wrote:
>
> >I am writing a class that is intended to be subclassed. What is the
> >proper way to indicate that a sub class must override a method?
>
> If any subclass *must* override a method, raise NotImplementedError
> in the base
Gabriel Genellina schrieb:
> At Thursday 4/1/2007 23:52, jeremito wrote:
>
>> I am writing a class that is intended to be subclassed. What is the
>> proper way to indicate that a sub class must override a method?
>
> If any subclass *must* override a method, raise NotImplementedError in
> the ba
At Thursday 4/1/2007 23:52, jeremito wrote:
I am writing a class that is intended to be subclassed. What is the
proper way to indicate that a sub class must override a method?
If any subclass *must* override a method, raise NotImplementedError
in the base class (apart from documenting how yo
At Thursday 4/1/2007 23:46, tubby wrote:
I understand that doing the following on Windows to a binary file (a
jpeg or exe files for example) can cause file corruption, is that correct?
fp = open(file_name, 'r')
fp.close()
How can a simple open in read mode corrupt data???
You can't corrupt *
jeremito wrote:
> I am writing a class that is intended to be subclassed. What is the
> proper way to indicate that a sub class must override a method?
raise NotImplementedError
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible b
Patch / Bug Summary
___
Patches : 418 open ( +5) / 3522 closed ( +1) / 3940 total ( +6)
Bugs: 959 open (+13) / 6405 closed ( +5) / 7364 total (+18)
RFE : 250 open ( +2) / 245 closed ( -1) / 495 total ( +1)
New / Reopened Patches
__
update to
jeremito schrieb:
> I am writing a class that is intended to be subclassed. What is the
> proper way to indicate that a sub class must override a method?
>
> Thanks,
> Jeremy
>
What do you mean by 'indicate'? Writing it to the docstring of the
class/method? Writing a comment?
class Foo:
At Thursday 4/1/2007 17:49, Erik Johnson wrote:
Python 2.3.4 (#1, Feb 7 2005, 15:50:45)
Traceback (most recent call last):
File "", line 1, in ?
File "Sub.py", line 4, in ?
class Sub(Super):
TypeError: function takes at most 2 arguments (3 given)
Why does python complain about a functi
On 2007-01-05, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> At Thursday 4/1/2007 10:12, siggi wrote:
>
>>Thanks for the explanation. I am astonished what an interpreted
>>language is able to do!
>
> Python is as interpreted as Java.
But it's far more interactive -- at least when compared with my
At Thursday 4/1/2007 17:26, Emin wrote:
I got some unexpected behavior in getattr and copy.deepcopy (see
transcript below). I'm not sure if this is actually a bug in
copy.deepcopy or if I'm doing something too magical with getattr.
Comments would be appreciated.
Both examples are different. #1
I am writing a class that is intended to be subclassed. What is the
proper way to indicate that a sub class must override a method?
Thanks,
Jeremy
--
http://mail.python.org/mailman/listinfo/python-list
Does a py script written to open and read binary files on Windows affect
files on a Linux or Mac machine in a negative way? My concern is
portability and safety. I want scripts written within Windows to work
equally well on Linux and Mac computers.
Is this the safest, most portable way to open
At Thursday 4/1/2007 07:07, Raymond wrote:
I want to Draw rectangle on Dc when gived a position. Can you teach
me? Let me view your code?
This is more a Windows question. See
http://msdn.microsoft.com/library/en-us/gdi/rectangl_4b03.asp
py>from win32gui import GetDC
py>hdc=GetDC(0)
py>from
At Thursday 4/1/2007 10:12, siggi wrote:
Thanks for the explanation. I am astonished what an interpreted language is
able to do!
Python is as interpreted as Java. Its numerical capabilities are more
or less independent of this fact, I'd say.
--
Gabriel Genellina
Softlab SRL
On Jan 4, 10:00 am, "siggi" <[EMAIL PROTECTED]> wrote:
> Thanks for that, too!
>
> Would be interesting to learn how these different algorithms [for pow]
> influence the
> precision of the result!?
For an integer (i.e., int or long) x and a nonnegative integer y, x**y
is exact:
>>> 101 ** 12
fscked schrieb:
> # Create the base element
> boxes = doc.createElement("boxes")
> myfile = open('ClientsXMLUpdate.txt')
> csvreader = csv.reader(myfile)
> for row in csvreader:
> mainbox = doc.createElement("box")
> doc.appendChild(boxes)
> r2 = csv.reader(myfile)
> b = r2.next()
_ wrote:
> (I did google for this, I promise)
>
> How do I get python NOT to insert newlines into string representations
> of lists when I do something like this:
>
> strCollector += "%s" % (['a', 'list', 'with', 'lots', 'of', 'elements']
> * 100)
It shouldn't and doesn't insert newlines.
##
On Thu, 2007-01-04 at 17:01 -0800, _ wrote:
> (I did google for this, I promise)
>
> How do I get python NOT to insert newlines into string representations
> of lists when I do something like this:
>
> strCollector += "%s" % (['a', 'list', 'with', 'lots', 'of', 'elements']
> * 100)
What makes yo
(I did google for this, I promise)
How do I get python NOT to insert newlines into string representations
of lists when I do something like this:
strCollector += "%s" % (['a', 'list', 'with', 'lots', 'of', 'elements']
* 100)
?
I would like to set a default never to do this, if possible. (Never
Announcing argparse 0.4
---
argparse home:
http://argparse.python-hosting.com/
argparse single module download:
http://argparse.python-hosting.com/file/trunk/argparse.py?format=raw
argparse bundled downloads at PyPI:
http://www.python.org/pypi/argparse/
New in this
Steven Bethard schrieb:
> If someone has an idea how to include argparse features into optparse,
> I'm certainly all for it. But I tried and failed to do this myself, so
> I don't know how to go about it.
Martin v. Löwis wrote:
> It's not necessary that the implementation is retained, only tha
How do I find out the cache line length of a machine in python?
Thanks,
--j
--
http://mail.python.org/mailman/listinfo/python-list
goodepic wrote:
> I'm newish to python and just got my first mac, so sorry if this is
> stupid. I have a little app developed by someone else in wxGlade that
> implements a complex stats package and language package, all in python.
> It works fine on my work PC, but not on my laptop. I have a n
So you know you are subclassing a module.
There is an answer @
http://www.velocityreviews.com/forums/showpost.php?p=1819038&postcount=2
On Jan 4, 3:49 pm, "Erik Johnson" wrote:
> I ran into a problem I didn't understand at first. I got part of it figured
> out. Let me first demonstrate the origi
Also, if it makes a difference, the lines quoted in the error message
were actually written automatically by wxGlade.
--
http://mail.python.org/mailman/listinfo/python-list
I'm newish to python and just got my first mac, so sorry if this is
stupid. I have a little app developed by someone else in wxGlade that
implements a complex stats package and language package, all in python.
It works fine on my work PC, but not on my laptop. I have a new
macbook 2ghz core duo,
Erik Johnson wrote:
> My questions are:
>
> Why does python complain about a function here? (it's a class definition
> statement, right?)
Because you're calling the function with the wrong number of arguments.
> Is there really a function being called here?
Yes. (Well, it's not exactly a functi
Steven Bethard <[EMAIL PROTECTED]> writes:
> Martin v. Löwis wrote:
> > Steven Bethard schrieb:
> >> If someone has an idea how to include argparse features into optparse,
> >> I'm certainly all for it. But I tried and failed to do this myself, so I
> >> don't know how to go about it.
> > It's not
I ran into a problem I didn't understand at first. I got part of it figured
out. Let me first demonstrate the original problem:
> cat Super.py
class Super(object):
def __init__(self):
self._class = 'Super'
def hello(self):
print "%s says 'Hello'" % self._class
> cat Sub.py
Raymond schrieb:
> Hi:
>
> I want to Draw rectangle on Dc when gived a position. Can you teach me? Let
> me view your code?
Well, you haven't given us much background but I'd suggest if your boss
asks you to draw a rectangle on your corporate domain controller and the
position allows this, you bet
Dear experts,
I got some unexpected behavior in getattr and copy.deepcopy (see
transcript below). I'm not sure if this is actually a bug in
copy.deepcopy or if I'm doing something too magical with getattr.
Comments would be appreciated.
Thanks,
-Emin
# Transcript follows ###
> Why not use OO.org to convert DOC to PDF? It does so natively, IIRC.
I can't insert variables if the template is a DOC file. This is why we
are using RTF.
Felipe Almeida Lessa wrote:
> On 3 Jan 2007 10:52:02 -0800, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> > I have tried to
> > convert
Ben Sizer wrote:
> robert wrote:
>> Ben Sizer wrote:
>>> My opinion is that this is not as big a problem as some may feel that
>>> it is. Unlike Unix systems, the PATH variable is rarely used.
>> It is a big problem.
>>
>> It is not less than the majority of Python users (at least those who do
>>
Hello,
I was trying to install my script (.py) to (.exe) and when I run setup
script with cmd I get the
error:
python mysetup.py py2exe
error: COREDLL.dll: No such file or directory
Thanks!!!
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> > if type(var) is types.SetType:
> >blah
> >
> > but that is not available in types module. I am using 2.4
>
> # set or subclass of set
> if isinstance(var, set):
> ...
or
if isinstance(var, (set, frozenset)):
...
-Mike
--
http://mail.python.o
Ognjen Bezanov wrote:
> I have some external C libraries I would like to use with python.
>
> I have been searching on the internet and found many such
> modules/bindings for libraries (e.g. Py-Lame) but have not yet
> come across any information of how to actually go about creating such
> bindin
_ wrote:
> How do you check to see if a variable is a set? I would like to use
>
> if type(var) is types.SetType:
>blah
>
> but that is not available in types module. I am using 2.4
# set or subclass of set
if isinstance(var, set):
...
# exact match
if type(v
_ wrote:
> How do you check to see if a variable is a set? I would like to use
>
> if type(var) is types.SetType:
>blah
>
> but that is not available in types module. I am using 2.4
In [1627]: type(set()) is set
Out[1627]: True
--
Robert Kern
"I have come to believe that the whole world
I've seen people do that using an exception, e.g.
try:
foo
except :
#variable foo not defined
On Jan 4, 2007, at 10:48 AM, _ wrote:
> How do you check to see if a variable is a set? I would like to use
>
> if type(var) is types.SetType:
>blah
>
> but that is not available in types mo
>From: Paul Watson <[EMAIL PROTECTED]>
>Probably most helpful to you is:
>
>http://developer.mozilla.org/es4/proposals/slice_syntax.html
Oh, the step. Okay, thanks ;)
Eric
_
Communicate instantly! Use your Hotmail address to sign in
How do you check to see if a variable is a set? I would like to use
if type(var) is types.SetType:
blah
but that is not available in types module. I am using 2.4
--
http://mail.python.org/mailman/listinfo/python-list
On 1/4/07, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> Ognjen Bezanov schrieb:
> > I have some external C libraries I would like to use with python.
> >
> > I have been searching on the internet and found many such
> > modules/bindings for libraries (e.g. Py-Lame) but have not yet
> > come acros
Paul Watson wrote:
> Eric Price wrote:
>> Hello;
>> I'm studying some code examples from the python cookbook site. I came
>> across this:
>>
>> def colsplit(l, cols):
>>rows = len(l) / cols
>>if len(l) % cols:
>>rows += 1
>>m = []
>>for i in range(rows):
>>m.append(
Eric Price wrote:
> Hello;
> I'm studying some code examples from the python cookbook site. I came
> across this:
>
> def colsplit(l, cols):
>rows = len(l) / cols
>if len(l) % cols:
>rows += 1
>m = []
>for i in range(rows):
>m.append(l[i::rows])
>return m
>
>
Martin v. Löwis wrote:
> Steven Bethard schrieb:
>> If someone has an idea how to include argparse features into optparse,
>> I'm certainly all for it. But I tried and failed to do this myself, so I
>> don't know how to go about it.
>
> It's not necessary that the implementation is retained, only
On 2007-01-04, Peter Otten <[EMAIL PROTECTED]> wrote:
> Neil Cerutti wrote:
>> Another trick is to factor the key application out of the
>> sort. This may be a good idea if when you want to minimize the
>> number of times your key function is called.
>>
>> The idea is to mangle the list temporaril
Thank you Thomas.
On Jan 3, 11:10 pm, Thomas Heller <[EMAIL PROTECTED]> wrote:
> wcc schrieb:
>
> > 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)?It seems the python-win32 mai
Thanks for all replies. I'll just to have to figure our which suggested
method I should use. To answer Jussi's question, this is why I asked
the question. I have the book by Mark: Python Programming on Win32.
In Charpter 12: Advanced Python and COM there is a sample code named:
DynamicPolicy.py.
Martin v. Löwis wrote:
<...snip...>
> I find that hard to believe. There is no code in Python that does
> removal of characters, and I can't see any other reason why it gets
> removed.
>
> OTOH, what I do get when writing to a file is a UnicodeError, when
> it tries to convert the Unicode string
siggi wrote:
> Now the test for module math with function pow():
> ---
> >>> pow(9,9)
> 387420489
>
> Fine, but sqrt() fails:
> ---
> >>> sqrt(9)
> I get this error message
>
> 'Traceback (most recent call last):
> File "", line 1,
Thomas Ploch schrieb:
> I am having troubles with implementing a timed queue. I am using the
> 'Queue' module to manage several queues. But I want a timed access, i.e.
> only 2 fetches per second max. I am horribly stuck on even how I
> actually could write it. Has somebody done that before? And wh
Neil Cerutti wrote:
> Another trick is to factor the key application out of the sort.
> This may be a good idea if when you want to minimize the number
> of times your key function is called.
>
> The idea is to mangle the list temporarily so you can use an
> unkeyed sort, and then unmangle the so
Sequence slicing [starting-at-index : but-less-than-index [ : step]].
Start defaults to 0, end to len(sequence), step to 1.
So l[i::rows] means: slicing start from i, ending with len(l) and step
with rows. So function colsplit(l, cols) returns a list of sequence
with conversion of:
Assume cols =
Ognjen Bezanov schrieb:
> I have some external C libraries I would like to use with python.
>
> I have been searching on the internet and found many such
> modules/bindings for libraries (e.g. Py-Lame) but have not yet
> come across any information of how to actually go about creating such
> bindi
fscked schrieb:
> Well, let me clarify. If I just print it to the screen/console it works
> fine, but when I do:
>
> out.write( doc.toprettyxml())
>
> it just removes the character that would be the "ö".
>
> I can post the code if anyone wants to see it, but it is fairly
> straightforward.
I fi
Hello;
I'm studying some code examples from the python cookbook site. I came across
this:
def colsplit(l, cols):
rows = len(l) / cols
if len(l) % cols:
rows += 1
m = []
for i in range(rows):
m.append(l[i::rows])
return m
What I'd like to know is what is the double
Thomas Ploch wrote:
> I am having troubles with implementing a timed queue. I am using
> the 'Queue' module to manage several queues. But I want a timed
> access, i.e. only 2 fetches per second max. I am horribly stuck on
> even how I actually could write it. Has somebody done that before?
> And w
Hello,
I have some external C libraries I would like to use with python.
I have been searching on the internet and found many such
modules/bindings for libraries (e.g. Py-Lame) but have not yet
come across any information of how to actually go about creating such
bindings, so I was wondering if a
Martin v. Löwis wrote:
> fscked schrieb:
> > 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?
>
> Works fine
On 2007-01-03, dwelden <[EMAIL PROTECTED]> wrote:
> I have successfully used the sort lambda construct described in
> http://mail.python.org/pipermail/python-list/2006-April/377443.html.
> However, how do I take it one step further such that some
> values can be sorted ascending and others descendi
Thomas Heller skrev:
> [EMAIL PROTECTED] schrieb:
> > [EMAIL PROTECTED] skrev:
> >
> >> Hi,
> >>
> >> I wish to write a Python wrapper for my C# COM object but am unsure
> >> where to start. I have a dll and a tlb file, and I can use this object
> >> in C via the following code -
> >>
> >> // Con
[EMAIL PROTECTED] wrote:
>>Yes, this "gmpy" sounds good for calc things like that.
>>But not available on my machine.
>>ImportError: No module named gmpy
>
>
> What type of machine?
Windoof with Cygwin.
>
> The home page for gmpy is http://sourceforge.net/projects/gmpy/
>
> I have Windows ve
Thanks for that, too!
Would be interesting to learn how these different algorithms influence the
precision of the result!?
"Boris Borcic" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> siggi wrote:
>> Hi all,
>>
>> this is a newbie question on :
>> Python 2.5 (r25:51908,
> Yes, this "gmpy" sounds good for calc things like that.
> But not available on my machine.
> ImportError: No module named gmpy
What type of machine?
The home page for gmpy is http://sourceforge.net/projects/gmpy/
I have Windows versions available at http://home.comcast.net/~casevh/
casevh
-
Thomas Ploch wrote:
> I am having troubles with implementing a timed queue. I am using the
> 'Queue' module to manage several queues. But I want a timed access, i.e.
> only 2 fetches per second max. I am horribly stuck on even how I
> actually could write it. Has somebody done that before? And when
On 1/4/07, Chaz Ginger <[EMAIL PROTECTED]> wrote:
> I have a rather large Python/Twisted Matrix application that will be run
> on Windows, Linux and perhaps Macs. I was wondering if there are any
> tools that can be used to create an installer that will bring in Python,
> Twisted Matrix, my applica
Mainly, it was fload-div. Changed to int-div (python //) runs faster.
Yes, this "gmpy" sounds good for calc things like that.
But not available on my machine.
ImportError: No module named gmpy
Anyway, thanks for posting. This gmpy module can be very intersting.
But right now, the focus was, if i
On 1/4/07, Chaz Ginger <[EMAIL PROTECTED]> wrote:
> I have a rather large Python/Twisted Matrix application that will be run
> on Windows, Linux and perhaps Macs. I was wondering if there are any
> tools that can be used to create an installer that will bring in Python,
> Twisted Matrix, my applica
I have a rather large Python/Twisted Matrix application that will be run
on Windows, Linux and perhaps Macs. I was wondering if there are any
tools that can be used to create an installer that will bring in Python,
Twisted Matrix, my application libraries and anything else I need?
I have tried
I am using ftplib in some code that does exactly what you would expect.
It ftp's files. Its running inside a service running on windows xp
and windows 2003 servers, approximately 20 installations each
installation sends between 100 and 1000 files per day. Occasionally the
process will hang comple
Hello folks,
I am having troubles with implementing a timed queue. I am using the
'Queue' module to manage several queues. But I want a timed access, i.e.
only 2 fetches per second max. I am horribly stuck on even how I
actually could write it. Has somebody done that before? And when yes,
how is t
siggi wrote:
> Hi all,
>
> this is a newbie question on :
> Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on
> win32
> PC with WinXP
>
> In
> http://www.python.org/doc/2.3.5/lib/module-math.html
> I read:
>
> "sqrt( x) Return the square root of x."
>
> Now the test f
> Sebastian 'lunar' Wiesner <[EMAIL PROTECTED]> (SW) wrote:
>SW> I don't see a problem with SUID on scripts. If you restrict write access
>SW> to the owner, modification is hardly possible.
>SW> However, if you allow world-wide write access to your binaries and
>SW> scripts, both can easily b
Peter Otten wrote:
> Wade Leftwich wrote:
>
> > from itertools import groupby
> >
> > def chunk(it, n=0):
> > if n == 0:
> > return iter([it])
> > def groupfun((x,y)):
> > return int(x/n)
> > grouped = groupby(enumerate(it), groupfun)
> > counted = (y for (x,y) in gr
Thanks for the explanation. I am astonished what an interpreted language is
able to do!
"Fredrik Lundh" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> "siggi" wrote:
>
>> Nope, I did not! But I used sqrt(9), and not math.sqrt(9). The latter
>> works
>> excellent, thank you!
"Vertilka" <[EMAIL PROTECTED]> wrote:
> I saw several functions: PyRun_AnyFileExFlags, PyRun_SimpleFileExFlags,
> PyRun_FileExFlags.
>
> Questions:
> 1) Which one should i use in order to achieve what i need ?
PyRun_SimpleFile or PyRun_SimpleString should be good enough. Using
SimpleString is mo
What i need from my C application to do ?
1) To execute a python script from file.
2) The python script will call functions in my C application.
According to the answer from Ravi Teja (topic "C app and Python"), I
need to extend embedded python in my C application.
I saw several functions: PyRun_
Wade Leftwich wrote:
> from itertools import groupby
>
> def chunk(it, n=0):
> if n == 0:
> return iter([it])
> def groupfun((x,y)):
> return int(x/n)
> grouped = groupby(enumerate(it), groupfun)
> counted = (y for (x,y) in grouped)
> return ((z for (y,z) in x)
Wade Leftwich wrote:
> 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 fo
mm <[EMAIL PROTECTED]> wrote:
> (Yes, I konw whats an object is...)
> BTW. I did a translation of a pi callculation programm in C to Python.
> (Do it by your own... ;-)
> Calc PI for 800 digs(?). (german: Stellen)
> int a=1,b,c=2800,d,e,f[2801],g;main(){for(;b-c;)f[b++]=a/5;
> for(;
"siggi" wrote:
> Nope, I did not! But I used sqrt(9), and not math.sqrt(9). The latter works
> excellent, thank you! From now on, I will use "import math" and
> "math.fuction()" for EVERY mathematical function, even for pow() etc. just
> to be on the safe side!
pow and math.pow are two slightly d
On Wed, 03 Jan 2007 23:27:57 -0800, wcc wrote:
> Hello,
>
> How do I create a class using a variable as the class name?
Try a "class factory".
def create_class(classname):
class Klass(object):
def __init__(self):
print "Creating object of %s..." % self.__class__.__name__
pyperl - Perl for Python
"This is a Python extension module that makes it possible to embed Perl
interpreter(s) in any Python program. It can be used to invoke
arbitrary Perl code, load any Perl modules and make calls directly
into Perl functions. The Perl code invoked ca
Ben Finney a écrit :
(snip)
> The "Singleton" pattern does what you say here. Implementing a proper
> Singleton in Python is complicated and hard to understand.
Really ? Using __new__ and a class attribute, it doesn't seem so
complicated - nor difficult to understand...
--
http://mail.python.org
1 - 100 of 119 matches
Mail list logo