like format function in Visual Basic,
format("##.##%",0.3456) ==>> 34.56%
--
http://mail.python.org/mailman/listinfo/python-list
file reading latency is mainly caused by large reading frequency, so reduction
of the frequency of file reading may be way to solved your problem.
u may specify an read bytes count for python file object's read() method, some
large value(like 65536) can be specified due to ur memory usage, and u
: #error "LONG_BIT definition appears wrong for platform
(bad gcc/glibc config?)."
make: *** [Modules/python.o] Error 1
Thanks and Regards,
Ginger--
http://mail.python.org/mailman/listinfo/python-list
with my appreciation.
thanks and regards
Ginger
--
http://mail.python.org/mailman/listinfo/python-list
it does have one in activepython
Thanks and Regards,
Ginger
- Original Message -
From: "Russ P." <[EMAIL PROTECTED]>
To:
Sent: Wednesday, November 07, 2007 8:56 AM
Subject: command-line arguments in IDLE
> Is it possible to pass command-line arguments when run
On Wed, 26 Jul 2006 10:54:48 -0700, Carl J. Van Arsdall wrote:
> Alright, based a on discussion on this mailing list, I've started to
> wonder, why use threads vs processes. So, If I have a system that has a
> large area of shared memory, which would be better? I've been leaning
> towards thr
[EMAIL PROTECTED] wrote:
> Andre Meyer:
>> What is the preferred pythonic way of implementing singleton elegantly?
>
> Maybe to just use a module.
>
> Bye,
> bearophile
>
Here is some sample code for both singleton classes and named classes
that I use:
> class Singleton(type):
> """
>
KraftDiner wrote:
> I have a question..
>
> myGlobalDictionary = dictionary()
>
>
> class someClass:
>def __init__(self):
> self.x = 0;
>def getValue(self, v)
> myGlobalDictionary.getVal(v)
>
>
> myGlobalDictionary doesn't seem to be visible to my someClass methods.
> Why?
KraftDiner wrote:
> I have a dictionary and sometime the lookup fails...
> it seems to raise an exception when this happens.
> What should I do to fix/catch this problem?
>
> desc = self.numericDict[k][2]
> KeyError: 589824 < This is the error that is being produced,
> because there is n
Edward Diener No Spam wrote:
> [EMAIL PROTECTED] wrote:
>> Edward> The definition of a component model I use below is a class
>> which
>> Edward> allows properties, methods, and events in a structured way
>> which
>> Edward> can be recognized, usually through some form of introspection
Joe Seigh wrote:
> Martin v. Löwis wrote:
>> You still didn't say what you would suggest to make it thread-safe
>> again; most likely, you proposal would be to add locking. If I
>> understand Joe's approach correctly, he has a solution that does
>> not involve locking (although I don't understand h
If you are looking for a "real" python to C, well in this case
C++ look for the shedskin compiler. It will take a rather
nice subset of Python and generate C++ code from it.
It is still rather experimental but I have been using it.
Chance G.
On Mon, 05 Jun 2006 07:19:39 -0700, Fuzzyman wrote:
Isn't Pyrex for writing extensions to Python? As for PyPy, I
didn't scroll down far enough to see the compiler info. It
does say it is Python written in Python at the top.
Shedskin is nothing but a compiler.
On Wed, 07 Jun 2006 19:13:27 +0200, Carl Friedrich Bolz wrote:
> Chance
On Fri, 30 Jun 2006 10:19:46 +, Michele Petrazzo wrote:
> Hi ng,
> what the preferred way for see if the dict has a key?
> We have a lot of solutions:
>
> key in dict
> key in dict.keys()
> dict.has_key(key)
> ...
>
> but what the better or the more "pythonic"?
>
> Thanks,
> Michele
It is
I was writing some code that used someone else class as a subclass. He
wrote me to tell me that using his class as a subclass was incorrect. I
am wondering under what conditions, if ever, does a class using a
subclass not work.
Here is an example. For instance the original class might look like
Fredrik Lundh wrote:
> please don't hit reply to arbitrary messages when you're posting new
> messages; it messes up the message threading.
>
> Chaz Ginger wrote:
>
>> I was writing some code that used someone else class as a subclass. He
>> wrote me
Gabriel Genellina wrote:
> At Thursday 24/8/2006 16:23, Chaz Ginger wrote:
>
>> I was writing some code that used someone else class as a subclass. He
>> wrote me to tell me that using his class as a subclass was incorrect. I
>> am wondering under what conditions, if ev
unexpected wrote:
> I have a program where based on a specific value from a dictionary, I
> call a different function. Currently, I've implemented a bunch of
> if..elsif statements to do this, but it's gotten to be over 30 right
> now and has gotten rather tedious. Is there a more efficient way to
I am somewhat new to Python (last year). As such I encounter little
"gotchas" all the time. I am wondering is someone can explain this to me:
If have three simple files:
a.py -
foo = None
def a(b):
global foo
foo = b
b.py --
from a impor
Duncan Booth wrote:
> Chaz Ginger wrote:
>
>> Can someone explain what is really going on here?
>
> Think of 'from x import y' as an assignment. Roughly equivalent to:
>
>y = sys.modules['x'].y
>
> (except of course you don't have to h
John Machin wrote:
> Chaz Ginger wrote:
>> I am somewhat new to Python (last year). As such I encounter little
>> "gotchas" all the time. I am wondering is someone can explain this to me:
>>
>> If have three simple files:
>>
>> a.py
glenn wrote:
> hi - Im quite new to python, wondering if anyone can help me understand
> something about inheritance here. In this trivial example, how could I
> modify the voice method of 'dog' to call the base class 'creatures'
> voice method from with in it?
>
> class creature:
> def __ini
Chaz Ginger wrote:
> glenn wrote:
>> hi - Im quite new to python, wondering if anyone can help me understand
>> something about inheritance here. In this trivial example, how could I
>> modify the voice method of 'dog' to call the base class 'creatu
Jason wrote:
> Chaz Ginger wrote:
>> Chaz Ginger wrote:
>>> glenn wrote:
>>>> hi - Im quite new to python, wondering if anyone can help me understand
>>>> something about inheritance here. In this trivial example, how could I
>>>> modify the vo
glenn wrote:
>> Shouldn't that be
>>
>> beagle = animal.dog()
>>
>> to create an instance?
>>
>> We've all done it ...
> lol - actually Im confused about this - there seem to be cases where
> instantiaing with:
> instance=module.classname()
> gives me an error, but
> instance=module.classname
> doe
Georg Brandl wrote:
> Chaz Ginger wrote:
>> glenn wrote:
>>>> Shouldn't that be
>>>>
>>>> beagle = animal.dog()
>>>>
>>>> to create an instance?
>>>>
>>>> We've all done it ...
>&
Neil Cerutti wrote:
> On 2006-08-30, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
>> On Wed, 30 Aug 2006 14:22:16 +1000, Ben Finney <[EMAIL PROTECTED]> wrote:
>>> "glenn" <[EMAIL PROTECTED]> writes:
>>>
Bruno Desthuilliers wrote:
> It might be better to use newstyle classes if you can. A
Here is a problem I am trying to solve; I am sure there must be an easy
way to do it and I just don't know how.
I have a rather large application that I am writing. To make it easy for
the user to run I have them run a startup.py script. This script will
try to load each of the third party libr
Steve Holden wrote:
> [EMAIL PROTECTED] wrote:
>> Hi,
>>
>> I am writing a library in which I need to find the names of methods
>> which are implemented in a class, rather than inherited from another
>> class. To explain more, and to find if there is another way of doing
>> it, here is what I want
Steve Holden wrote:
> Chaz Ginger wrote:
>> Steve Holden wrote:
>>
>>> [EMAIL PROTECTED] wrote:
>>>
>>>> Hi,
>>>>
>>>> I am writing a library in which I need to find the names of methods
>>>> which are implemented in
I have a system that has a few lists that are very large (thousands or
tens of thousands of entries) and some that are rather small. Many times
I have to produce the difference between a large list and a small one,
without destroying the integrity of either list. I was wondering if
anyone has any r
I've done that and decided that Python's 'list comprehension' isn't a
way to go. I was hoping that perhaps someone had some experience with
some C or C++ library that has a Python interface that would make a
difference.
Chaz
Sybren Stuvel wrote:
> Bill Williams enlightened us with:
>> I don't kno
Paul Rubin wrote:
> Sybren Stuvel <[EMAIL PROTECTED]> writes:
>>> I don't know enough about Python internals, but the suggested
>>> solutions all seem to involve scanning bigList. Can this presumably
>>> linear operation be avoided by using dict or similar to find all
>>> occurrences of smallist it
Larry Bates wrote:
> Chaz Ginger wrote:
>> I have a system that has a few lists that are very large (thousands or
>> tens of thousands of entries) and some that are rather small. Many times
>> I have to produce the difference between a large list and a small one,
>
Jeremy Sanders wrote:
> Jeremy Sanders wrote:
>
>> Chaz Ginger wrote:
>>
>>> What would sets do for me over lists?
>> It's faster to tell whether something is in a set or dict than in a list
>> (for some minimum size).
>
> As a footnote, thi
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 rather new at Python so I want to get it right. What I am doing
is writing a rather large application with plenty of places that
strings will be used. Most of the strings involve statements of
one kind or another.
I would like to make it easy for the support people to port the
application f
geoffbache wrote:
>> Twisted *should* be able to do this, as it uses non-blocking IO.
>>
>> http://twistedmatrix.com/trac/
>
> Thanks for the tip. I'll take a look if nobody has any better
> suggestions.
>
> It still seems to me that what I'm trying to do is essentially quite
> simple, and should
I have a web service that I built and it requires using SSL. I have
found a few examples of clients using SSL but none that allow me to
change the client's certificate or the chain of certificates the client
will use to authenticate the server.
I was wondering if anyone knows of a good example
I have a need for the minimal Linux system to run Python. Basically I
want the system to boot up and instead of starting up Init/etc. I would
love it to run python (and a python script I have written).
Before embarking on doing it myself I was wondering if anyone knew of
just such a system?
Peace
I am writing a distributed server system using Python. I need to support
authentication and was wondering what approaches are available under
Python and what are the best practices.
Thanks in advance
Chaz
--
http://mail.python.org/mailman/listinfo/python-list
Thomas Krüger wrote:
> Chaz Ginger schrieb:
>> I am writing a distributed server system using Python. I need to support
>> authentication and was wondering what approaches are available under
>> Python and what are the best practices.
>
> Well, there are many ways o
I have been looking for a server application as an example of how to use
TLSLite or PyOpenSSL X509 certificates for authentication. Does any one
have a pointer or two?
Peace,
Chaz
--
http://mail.python.org/mailman/listinfo/python-list
HIi all:
I am a new beginner to python, would you like give me some advice on
studying it?
Welcome to list some book on python for me.
Thanks a lot.
--
http://mail.python.org/mailman/listinfo/python-list
I have a problem that I am trying to solve. I have two different
systems - one written in C and another in Python. I would like the
two to exchange some information.
On the Python side I decided to use cPickle. On the C side I would
write a library that can read the cPickle and generate the corre
I am trying to write a tool to examine a function (I'd like it
to work with pyc files only). So here are a few questions I
have; any pointers would be very welcome.
Can I determine the number of arguments required of a function?
Is there a way to detect is the function will throw an exception
(I
If I define a decorator like:
def t(x) :
def I(x) : return x
return I
and use it like:
@t(X)
def foo(a) :
# definition of foo...
pass
or maybe this:
@t(X)
@(Y)
def bar(a) :
# The definition of bar...
Will in encounter much of a penalty in executing
'f
On Sun, 09 Apr 2006 09:51:18 +0200, Fredrik Lundh wrote:
> Chance Ginger" wrote:
>
>> If I define a decorator like:
>>
>> def t(x) :
>> def I(x) : return x
>> return I
>
> ... you get a syntax error.
>
It isn't a syntax error...I tried
r 2006 08:52:18 -0700, Carl Banks wrote:
>
> Chance Ginger wrote:
>> On Sun, 09 Apr 2006 09:51:18 +0200, Fredrik Lundh wrote:
>>
>> > Chance Ginger" wrote:
>> >
>> >> If I define a decorator like:
>> >>
>> >> def t(x) :
Greetings! I am trying to make a multiplayer (no AI, 2 person) game of
tic tac toe in Python. So far it has been pretty simple. My only
concern is with the win checking to see if a person has won. At first
it looked like it was working, but now it sometimes assigns a win when
you enter an X or
Thank you. It seems I didn't understand logic statements as much as I
thought I did!
The one remaining question I have deals with this:
if gameboard[cell] not in 'OX':
gameboard[cell] = 'O'
else:
print "This cell is already filled."
turnnumber -= 1
(gameboard[cell]
So is there a way I have to set up the string OX in the beginning? Is
this where it houses the location of the Xs and Os to determine whether
or not a letter is already there?
--
http://mail.python.org/mailman/listinfo/python-list
Nevermind my previous reply: I've been fixing up the code and
understand it. I'm at a nifty 80 lines where I am at now rather than
209 lines in the previous version! The changes are immense!
The only problem I have is whenever player two goes, it says the cell
is filled. But the code:
if gameb
The code's indentation was fine - I forgot to declare cell in player
two's section and not just in player one.
The code (including the win check, for once!) is working. The last
obstacle is my tie checker; it doesn't seem to like what I have:
if ((gameboard[0:9] is 'X' or 'O') and (win == 0)):
Another question: I am writing a sudoku solving program. The
'solving' part of is just multiple iterations. It will take random
numbers and keep switching it all around until a set of logic
statements has been met (ie; all numbers in a row are not equal to each
other) ... that's where my questio
For the
not cellboard[0] in cellboard[1:8] (I knew about ranges/slicing using a
colon, can't believe I didn't think of that!)
line, will I have to write that out for each number?
So the line:
not cellboard in ((cellboard[1:8]) and (cellboard[9] and cellboard[18]
and cellboard[27] and cellboard[
How do I 'define' set? Is there something to include (like import
random)?
while (choice == 3) and len(set(cellboard[0:8]))==len(cellboard[0:8]):
# DEFINE TWO RANDOM VARIABLES (ONE FOR ARRAY, ONE FOR NUMBER
VALUE)
solvingrandom = random.randint(1,9)
cellboardrandom = rando
Is there some command in python so that I can read a key's input and
then use a gotoxy() function to move the cursor on screen? e.g.:
(psuedo-code)
When the right arrow is pushed, cursor gotoxy(x+1,y)
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks -- I downloaded WConio.
When I just tried it out in the IDLE, it said:
NameError: name 'WConio' is not defined
I assume I have to use a header somewhere (import WConio ?). Or is
there something I'm missing (I downloaded the Python 2.4 (I have 2.4.2)
auto installer and it ran fine...)
--
OK - I added the import WConio line. But when I run
import WConio
print "going to x10,y10..."
WConio.gotoxy(10,10)
print "Done"
the above, I get the following error:
WConio.gotoxy(10,10)
error: GetConOut Failed
I installed the WConio to the ../site-packages/ folder in Python24, and
when it did
Now that I have gotoxy() down for moving the cursor around, I want that
to be a result of keypresses (namely from the numpad -- 7 = NorthWest,
8 = North, 9 = NE, etc...). I have little clue how to do this. After
searching google, I've come upon this; include:
import curses
in the header. Howev
61 matches
Mail list logo