I have a class with a method meant to verify internal program logic (not
data supplied by the caller). Because it is time-consuming but optional,
I treat it as a complex assertion statement, and optimize it away if
__debug__ is false:
class Parrot:
def __init__(self, *args):
print "
En Sun, 14 Dec 2008 02:40:10 -0200, Benjamin Kaplan
escribió:
On Sat, Dec 13, 2008 at 10:49 PM, Daniel Fetchinson <
fetchin...@googlemail.com> wrote:
>> Is it a feature that
>>
>> 1 or 1/0
>>
>> returns 1 and doesn't raise a ZeroDivisionError? If so, what's the
>> rationale?
>
> http://en.wik
On Sat, Dec 13, 2008 at 11:50 PM, Tim Chase
wrote:
>> Any special reasons?
>
> Because it is there (at least on my Debian box)?
>
But not on windows :(
>>> import time
>>> time.strftime("%e")
''
>>>
> t...@rubbish:~$ python
> Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
> [GCC 4.2.4 (De
> Let me just point out that unsuspecting people (like me) might rely on
> the whole expression to be evaluated and rely on exceptions being
> raised if needed.
This happens when people assume something ;)
Use a different construct if you want to catch error's, I don't
understand how you could not
1. Comparison sorts have n*ln(n) complexity - does not do
2. Counting sort has the complexity O(d), where d is domain (in our
case n^2) - does not do.
3. Radix sorts have the complexity O(n*k), where k is number of bits
in integer. (32?) There are 2 variants:
a. most significant digit (MSD),
b. lea
Hello,
in Python (contrary to Perl, for instance) there is one way to do common
tasks. Could somebody explain me what is the official python way of
printing unicode strings?
I tried to do this such way:
s = u"Stanisław Lem"
print u.encode('utf-8')
This works, but is very cumbersome.
Then I tried
In my own bot, using the latest xmpppy, I've been printing everything
going to the message handler to the screen. I've yet to see a
'subscribe' string. Has this changed?
James Mills wrote:
> On Wed, Nov 5, 2008 at 11:28 AM, James Mills
> wrote:
> > Can anyone shed any light on how I might
> >
On Dec 13, 2:29 pm, Karlo Lozovina <_kar...@_mosor.net_> wrote:
> Hi, I'm trying to implement text output interface, something similar to
> wget, using curses module. There are just two things I can't find out how
> to do: prevent curses from clearing the terminal when starting my program,
> and le
> "Sure" as in "sure, it was not intended behaviour"?
It was intended behavior, and still is in 3.0.
>> This behavior has not changed. It still uses repr().
>>
>> Of course, the string type has changed in 3.0, and now uses a different
>> definition of repr.
>
> So was the above-reported non-cras
En Sat, 13 Dec 2008 18:19:29 -0200, Emanuele D'Arrigo
escribió:
I'm trying to replicate the positive results of the Client/Server
scripts from the thread "Bidirectional Networking", but this time
using a Process/SubProcess architecture.
The SubProcess, acting as a server, is working just fin
On Sat, Dec 13, 2008 at 10:49 PM, Daniel Fetchinson <
fetchin...@googlemail.com> wrote:
> >> Is it a feature that
> >>
> >> 1 or 1/0
> >>
> >> returns 1 and doesn't raise a ZeroDivisionError? If so, what's the
> >> rationale?
> >
> > Yes, it's a feature:
> >
> > http://en.wikipedia.org/wiki/Short-
On Sat, Dec 13, 2008 at 10:54 PM, Amit Goyal wrote:
> Hi All,
>
> I am new to Python and was trying the sample code on Dive into Python
> for WSDL. Below is the error I get.
>
> Traceback (most recent call last):
> File "", line 4, in -toplevel-
>print 'Light sensor value: ' + server._ns(nam
"John Machin" wrote in message
news:a8cd683f-853d-4665-bee4-7a0bdb841...@c36g2000prc.googlegroups.com...
On Dec 14, 9:20 am, "Martin v. Löwis" wrote:
> >> This is intended behavior.
>
> > I see. That means that the behaviour in Python 1.6 to 2.6 (i.e.
> > encoding the text using the repr() fu
En Sat, 13 Dec 2008 13:03:17 -0200, Emanuele D'Arrigo
escribió:
On Dec 12, 9:04 pm, "Gabriel Genellina"
wrote:
If you're using 2.5 or older, override serve_forever:
def serve_forever(self):
while not getattr(self, 'quit', False):
self.handle_request()
and set the
How would I use suprocess to do the equivalent of:
cat - | program_a | program_b
--
http://mail.python.org/mailman/listinfo/python-list
> In a nutshell, this is likely to cause pain until all file systems are
> standardized on a particular encoding of Unicode. Probably only about
> another fifteen years to go ...
well, most Linux distros are defaulting to a UTF-8 locale now, the
exception beeing Gentoo&similar that expect the use
Hi All,
I am new to Python and was trying the sample code on Dive into Python
for WSDL. Below is the error I get.
Traceback (most recent call last):
File "", line 4, in -toplevel-
print 'Light sensor value: ' + server._ns(namespace).readLSpercent
(int_1 = "1")
File "c:\Python24\Lib\site-p
>> Is it a feature that
>>
>> 1 or 1/0
>>
>> returns 1 and doesn't raise a ZeroDivisionError? If so, what's the
>> rationale?
>
> Yes, it's a feature:
>
> http://en.wikipedia.org/wiki/Short-circuit_evaluation
>
> When you have "True or False", you know it's true by the time
> you've got the first p
On Sat, 13 Dec 2008 14:09:04 -0800, John Machin wrote:
> On Dec 14, 8:07 am, "Chris Rebert" wrote:
>> On Sat, Dec 13, 2008 at 12:28 PM, John Machin
>> wrote:
>>
>> > Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit
>> > (Intel)] on win32
>> > Type "help", "copyright", "credits
James Stroud wrote:
Be assured that it takes on special intelligence to write unintelligible
I meant "*no* special intelligence".
--
http://mail.python.org/mailman/listinfo/python-list
feba wrote:
This is what I have so far. better? worse?
Much better. I didn't check if it works. But you need to figure out a
way to give up on your reliance on global variables. They will end up
stifling you in the long run when you move to substantial projects.
Also, you should start movin
Not that I'm against promoting Python, but most languages have support for
short circuit evaluation. That's why you usually use && and || in C, C++, C#
and Java- & and | will always evaluate both sides. Short circuit evaluation
is what allows you to write things like "if foo is not None and
foo.isT
On Sat, 13 Dec 2008 19:17:41 +, Duncan Booth wrote:
> I think you must have fallen asleep during CS101. The lower bound for
> sorting where you make a two way branch at each step is O(n * log_2 n),
> but if you can choose between k possible orderings in a single
> comparison you can get O(n *
Aaron Brady wrote:
On Dec 13, 7:51 pm, Grant Edwards wrote:
On 2008-12-14, MRAB wrote:
I am writing a C process and I want to read data from a file that I
write to in Python. I'm creating a pipe in Python, passing it to the
C process, and calling '_read'. It gives me error 9, bad file nu
These are just the kind of things that make Python so beautiful ;)
Thanks Guido!
--
http://mail.python.org/mailman/listinfo/python-list
On Dec 13, 7:51 pm, Grant Edwards wrote:
> On 2008-12-14, MRAB wrote:
>
>
>
> >> I am writing a C process and I want to read data from a file that I
> >> write to in Python. I'm creating a pipe in Python, passing it to the
> >> C process, and calling '_read'. It gives me error 9, bad file numbe
On Dec 12, 6:17 pm, David Boddie wrote:
> That's correct, retrieveData() is a protected function in C++ and the
> QMimeData object was created by the framework, not you, in this case.
Ah, well that explains it. Figured as much but was hoping maybe I was
trying to access it incorrectly.
> You co
man...@gmail.com wrote:
On Dec 13, 11:13 pm, Bryan Olson wrote:
Software firewalls will often simply refuse incoming connections. The
basic protection of the garden-variety home router comes from "network
address translation" (NAT), in which case TCP connections initiated from
the inside wil
Is it a feature that
1 or 1/0
returns 1 and doesn't raise a ZeroDivisionError? If so, what's the rationale?
Yes, it's a feature:
http://en.wikipedia.org/wiki/Short-circuit_evaluation
When you have "True or False", you know it's true by the time
you've got the first piece, so there's no need
"Daniel Fetchinson" wrote:
> Is it a feature that
>
> 1 or 1/0
>
> returns 1 and doesn't raise a ZeroDivisionError? If so, what's the rationale?
See: http://en.wikipedia.org/wiki/Short-circuit_evaluation
--
http://mail.python.org/mailman/listinfo/python-list
Is it a feature that
1 or 1/0
returns 1 and doesn't raise a ZeroDivisionError? If so, what's the rationale?
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
--
http://mail.python.org/mailman/listinfo/python-list
On 2008-12-14, MRAB wrote:
>> I am writing a C process and I want to read data from a file that I
>> write to in Python. I'm creating a pipe in Python, passing it to the
>> C process, and calling '_read'. It gives me error 9, bad file number.
>>
>> Python code:
>>
>> import subprocess as s, o
Aaron Brady wrote:
Hi,
I am writing a C process and I want to read data from a file that I
write to in Python. I'm creating a pipe in Python, passing it to the
C process, and calling '_read'. It gives me error 9, bad file number.
Python code:
import subprocess as s, os
r, w= os.pipe( )
os.wr
Hi,
I am writing a C process and I want to read data from a file that I
write to in Python. I'm creating a pipe in Python, passing it to the
C process, and calling '_read'. It gives me error 9, bad file number.
Python code:
import subprocess as s, os
r, w= os.pipe( )
os.write( w, 'abcdefghij\n
On Dec 13, 11:13 pm, Bryan Olson wrote:
> Software firewalls will often simply refuse incoming connections. The
> basic protection of the garden-variety home router comes from "network
> address translation" (NAT), in which case TCP connections initiated from
> the inside will generally work, rega
Emanuele D'Arrigo wrote:
Hey Bryan, thank you for your reply!
Bryan Olson wrote:
Is it possible then to establish both a server and a client in the
same application?
Possible, and not all that hard to program, but there's a gotcha.
Firewalls, including home routers and software firewalls, typi
On Dec 14, 9:20 am, "Martin v. Löwis" wrote:
> >> This is intended behavior.
>
> > I see. That means that the behaviour in Python 1.6 to 2.6 (i.e.
> > encoding the text using the repr() function (as then defined) was not
> > intended behaviour?
>
> Sure.
"Sure" as in "sure, it was not intended be
"How To Make $1,000,000 THIS YEAR With our Online Business"
--
http://mail.python.org/mailman/listinfo/python-list
"How To Make $1,000,000 THIS YEAR With our Online Business"
--
http://mail.python.org/mailman/listinfo/python-list
On behalf of the Python development team and the Python community, I'm
happy to announce the release candidates of Python 2.4.6 and 2.5.3.
2.5.3 is the last bug fix release of Python 2.5. Future 2.5.x releases
will only include security fixes. According to the release notes, over
100 bugs and patc
>> This is intended behavior.
>
> I see. That means that the behaviour in Python 1.6 to 2.6 (i.e.
> encoding the text using the repr() function (as then defined) was not
> intended behaviour?
Sure. This behavior has not changed. It still uses repr().
Of course, the string type has changed in 3.0
"David Hláčik" writes:
> Hi guys,
>
> i am really sorry for making offtopic, hope you will not kill me, but
> this is for me life important problem which needs to be solved within
> next 12 hours..
>
> I have to create stable algorithm for sorting n numbers from interval
> [1,n^2] with time compl
On Dec 14, 8:07 am, "Chris Rebert" wrote:
> On Sat, Dec 13, 2008 at 12:28 PM, John Machin wrote:
>
> > Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit
> > (Intel)] on win32
> > Type "help", "copyright", "credits" or "license" for more information.
> x = u'\u9876'
> x
Am I missing something? There are no release dates for packages in
pypi.
One cannot have an idea how current the package is...
--
http://mail.python.org/mailman/listinfo/python-list
Aaron Brady wrote:
>So, what's the group policy on helping with homework? rhetorical>
In my book anyone who is dumb enough to ask for homework help on a
newsgroup and doesn't acknowledge that when they hand in their answer
deserves whatever they get. Oh, and of course there are 2 deliberate
2008/12/13 Aaron Brady
> On Dec 13, 1:17 pm, Duncan Booth wrote:
> > "Diez B. Roggisch" wrote:
> >
> >
> >
> > > David Hláčik schrieb:
> > >> Hi guys,
> >
> > >> i am really sorry for making offtopic, hope you will not kill me, but
> > >> this is for me life important problem which needs to be
Kay Schluehr wrote:
On 13 Dez., 00:16, Trent Mick wrote:
Note that currently PyWin32 is not included in ActivePython 3.0.
Is there any activity in this direction?
The PyWin32 CVS tree is getting checkins from Mark Hammond and Roger
Upole with a py3k tag. I'm not sure how close they are cu
On Sat, Dec 13, 2008 at 3:35 PM, sturlamolden wrote:
> On 10 Des, 19:42, cm_gui wrote:
>
> > And it is not just this Python site that is slow. There are many many
> > Python sites which are very slow. And please don't say that it could
> > be the web hosting or the server which is slow — because
On Sat, Dec 13, 2008 at 12:28 PM, John Machin wrote:
>
> Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
x = u'\u9876'
x
> u'\u9876'
>
> # As expected
>
> Python 3.0 (r30:6750
2008/12/13 John Machin :
>
> Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
x = u'\u9876'
x
> u'\u9876'
>
> # As expected
>
> Python 3.0 (r30:67507, Dec 3 2008, 20:14:27) [MS
On Dec 13, 1:17 pm, Duncan Booth wrote:
> "Diez B. Roggisch" wrote:
>
>
>
> > David Hláčik schrieb:
> >> Hi guys,
>
> >> i am really sorry for making offtopic, hope you will not kill me, but
> >> this is for me life important problem which needs to be solved within
> >> next 12 hours..
>
> >> I h
On 10 Des, 19:42, cm_gui wrote:
> And it is not just this Python site that is slow. There are many many
> Python sites which are very slow. And please don’t say that it could
> be the web hosting or the server which is slow — because when so many
> Python sites are slower than PHP sites, it could
On Dec 12, 7:31 am, Steve Holden wrote:
> sturlamolden wrote:
> > On Dec 12, 1:56 pm, sturlamolden wrote:
>
> >> That is because integers are immutable. When x += 1 is done on an int,
> >> there will be a rebinding. But try the same on say, a numpy array, and
> >> the result will be different:
sn
On 13 Des, 21:26, sturlamolden wrote:
> Python methods always have a return value, even those that seem to do
> not - they silently return None. Thus, __iadd__ must return self to
> avoid rebinding to None.
Except for immutable types, for which __iadd__ must return a new
instance.
--
http://
Hi, I'm trying to implement text output interface, something similar to
wget, using curses module. There are just two things I can't find out how
to do: prevent curses from clearing the terminal when starting my program,
and leaving my output after the program closes. Any way to do this with
cu
On Dec 11, 3:16 pm, jim-on-linux wrote:
> Aaron,
>
> The TraceBack is :
>
> TraceBack:
> File win32ui.pyc, line 12, in
> File win32ui.pyc Line 10, in _load
> ImportError: DLL Load Failed: The specified module
> could not be found.
snip
> > Both modules 'win32api.pyd' and win32ui.pyd are in
> >
Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> x = u'\u9876'
>>> x
u'\u9876'
# As expected
Python 3.0 (r30:67507, Dec 3 2008, 20:14:27) [MSC v.1500 32 bit
(Intel)] on win 32
Type "h
On 13 Des, 02:20, Hrvoje Niksic wrote:
> > tmp = mytuple.__getitem__(0)
> > tmp = tmp.__iadd__(1)
> > mytuple.__setitem__(0, tmp) # should this always raise an exception?
>
> What do you mean by "a sane parser"? This is exactly what happens in
> current Python.
Yes, but Steve Holden was sugge
On Dec 13, 2008, at 7:00 AM, stdazi wrote:
Hello!
I'm about to parallelize some algorithm that turned out to be too
slow. Before I start doing it, I'd like to hear some suggestions/hints
from you.
Hi stdazi,
If you're communicating between multiple processes with Python, you
might find my
Hi everybody,
I'm trying to replicate the positive results of the Client/Server
scripts from the thread "Bidirectional Networking", but this time
using a Process/SubProcess architecture.
The SubProcess, acting as a server, is working just fine. But the
Process executing the SubProcess, the client
Duncan Booth schrieb:
"Diez B. Roggisch" wrote:
David Hlá�ik schrieb:
Hi guys,
i am really sorry for making offtopic, hope you will not kill me, but
this is for me life important problem which needs to be solved within
next 12 hours..
I have to create stable algorithm for sorting n number
Diez B. Roggisch wrote:
David Hláčik schrieb:
Hi guys,
i am really sorry for making offtopic, hope you will not kill me, but
this is for me life important problem which needs to be solved within
next 12 hours..
I have to create stable algorithm for sorting n numbers from interval
[1,n^2] with
"Diez B. Roggisch" wrote:
> David HláÄik schrieb:
>> Hi guys,
>>
>> i am really sorry for making offtopic, hope you will not kill me, but
>> this is for me life important problem which needs to be solved within
>> next 12 hours..
>>
>> I have to create stable algorithm for sorting n numbers f
"David Hláčik" wrote:
> I have to create stable algorithm for sorting n numbers from interval
> [1,n^2] with time complexity O(n) .
Some kind of radix sort or counting sort. These algo. has O(n) complexity.
w.
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Dec 13, 2008 at 2:00 PM, David Hláčik wrote:
>> Unless I grossly miss out on something in computer science 101, the lower
>> bound for sorting is O(n * log_2 n). Which makes your task impossible,
>> unless there is something to be assumed about the distribution of numbers in
>> your sequen
> Unless I grossly miss out on something in computer science 101, the lower
> bound for sorting is O(n * log_2 n). Which makes your task impossible,
> unless there is something to be assumed about the distribution of numbers in
> your sequence.
There is n numbers from interval [1 , n^2]
I should d
frendy zhang wrote:
> if form.accepts(request.vars,session):
> for table in db.tables:
> rows=db(db[table].id).select()
> print rows
> open(str(os.sep).join([os.getcwd(), 'applications',
> request.application, 'databases',
>
David Hláčik schrieb:
Hi guys,
i am really sorry for making offtopic, hope you will not kill me, but
this is for me life important problem which needs to be solved within
next 12 hours..
I have to create stable algorithm for sorting n numbers from interval
[1,n^2] with time complexity O(n) .
C
Hi guys,
i am really sorry for making offtopic, hope you will not kill me, but
this is for me life important problem which needs to be solved within
next 12 hours..
I have to create stable algorithm for sorting n numbers from interval
[1,n^2] with time complexity O(n) .
Can someone please give m
On 11 Dec, 23:57, Christian Heimes wrote:
> Paul Moore schrieb:
> > That's what I thought. I was just hoping that using a debug build of
> > an extension would be usable with a standard release build of Python,
> > as that's what will be easy for most people to set up.
>
> A debug build changes la
On Sat, 13 Dec 2008 06:00:09 -0800, bearophileHUGS wrote:
> Steven D'Aprano:
>> The algorithm is unclear: try explaining what you are doing in English,
>> and see how difficult it is.
>
> That algorithm is a standard one, and quite clear. Any programmer worth
> his/her/hir salt has to be able to
On Sat, 13 Dec 2008 11:07:53 +, Steven D'Aprano wrote:
> Now, sure, most of the work in Tim's version is executed in fast C code
> instead of slow Python code.
Say what???
I'm sorry, I must have been smoking crack when I wrote that. It does
nothing of the sort. Tim's version is pure Python.
open(str(os.sep).join([
os.getcwd(),
'applications',
request.application,
'databases',
table+'.csv']),'w').write(str(db(db[table].id).select ()))
How can i encrypt and descrypt the created file above??
Well, as I was recently admonished (and have come to love), the
firs
Netbeans is a very polished IDE.
I just tried the Python EA plugin, however, and it does not have 3.x
support as of now.
--
http://mail.python.org/mailman/listinfo/python-list
Any special reasons?
Because it is there (at least on my Debian box)?
t...@rubbish:~$ python
Python 2.5.2 (r252:60911, May 28 2008, 08:35:32)
[GCC 4.2.4 (Debian 4.2.4-1)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import time
>>> time.str
Leo> Any special reasons?
Nobody thought to add it? Got a patch?
--
Skip Montanaro - s...@pobox.com - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list
Any special reasons?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list
#!/usr/bin/python
#Py3k, UTF-8
import random
def startup():
print("WELCOME TO THE SUPER NUMBER GUESSING GAME!")
global pnum, play, player, p1sc, p2sc
pnum = int(input("1 OR 2 PLAYERS?\n> "))
play = True
player = "P1" #P1 goes first
p1sc = 0 #Number of times...
p2sc = 0
Hey Bryan, thank you for your reply!
On Dec 13, 3:51 am, Bryan Olson wrote:
> > Is it possible then to establish both a server and a client in the
> > same application?
>
> Possible, and not all that hard to program, but there's a gotcha.
> Firewalls, including home routers and software firewalls
On Dec 12, 11:41 am, Bruno Desthuilliers
wrote:
> sturlamolden a écrit :
> (snip)
>
> > Creating a fast implementation of a dynamic language is almost rocket
> > science. But it has been done. There is Stronghold, the fastest
> > version of Smalltalk known to man, on which the Sun Java VM is based
On Dec 12, 6:58 am, bearophileh...@lycos.com wrote:
> sturlamolden:
>
> > On a recent benchmark Java 6 -server beats C compiled by GCC 4.2.3 And
> > most of that magic comes from an implementation of a dynamically typed
> > language (Smalltalk). [...]
> >http://shootout.alioth.debian.org/u32q/bench
if form.accepts(request.vars,session): for table in db.tables:
rows=db(db[table].id).select() print rows
open(str(os.sep).join([os.getcwd(), 'applications',
request.application, 'databases',
table+'.csv']),'w').write(s
if form.accepts(request.vars,session): for table in db.tables:
rows=db(db[table].id).select() print rows
open(str(os.sep).join([os.getcwd(), 'applications',
request.application, 'databases',
table+'.csv']),'w').write(s
On Dec 13, 12:08 am, "James Mills"
wrote:
> Just as a matter of completeness for my own suggestion, here
> is my implementation of your code (using circuits):
It's longer! But I bet is a little bit more resilient against all
sorts of problems that arise while using network connections.
Well, tha
On Dec 12, 9:04 pm, "Gabriel Genellina"
wrote:
> If you're using 2.5 or older, override serve_forever:
>
> def serve_forever(self):
> while not getattr(self, 'quit', False):
> self.handle_request()
>
> and set the server 'quit' attribute to True in response to some comma
bearophileh...@lycos.com wrote:
> When I write recursive code in Python I sometimes go past the maximum
> allowed stack depth, so I receive a really long traceback. The show of
> such traceback on my screen is very slow (despite a CPU able to
> perform billions of operations each second). So I thi
Marc 'BlackJack' Rintsch writes:
> On Sat, 13 Dec 2008 02:20:59 +0100, Hrvoje Niksic wrote:
>
>> Saner (in this respect) behavior in the tuple example would require
>> a different protocol. I don't understand why Python doesn't just
>> call __iadd__ for side effect if it exists. The decision to
On Sat, 13 Dec 2008 at 06:13, bearophileh...@lycos.com wrote:
When I write recursive code in Python I sometimes go past the maximum
allowed stack depth, so I receive a really long traceback. The show of
such traceback on my screen is very slow (despite a CPU able to
perform billions of operations
When I write recursive code in Python I sometimes go past the maximum
allowed stack depth, so I receive a really long traceback. The show of
such traceback on my screen is very slow (despite a CPU able to
perform billions of operations each second). So I think I'd like
something to shorten them.
I
Steven D'Aprano:
> The algorithm is unclear: try explaining
> what you are doing in English, and see how difficult it is.
That algorithm is a standard one, and quite clear. Any programmer
worth his/her/hir salt has to be able to understand that.
I agree that the idiom with the list comp (algorith
Poor Yorick wrote:
> I have a future statement in a script which is intended to work in 2.6 and 3.
> Shouldn't compile flags in __future__ objects essentially be noops for
> versions
> that already support the feature? doctest is complaining about unrecognised
> flags. This illustrates the proble
Hello!
I'm about to parallelize some algorithm that turned out to be too
slow. Before I start doing it, I'd like to hear some suggestions/hints
from you.
The algorithm essentially works like this: There is a iterator
function "foo" yielding a special kind permutation of [1,n]. The
main progr
Just to be clear, I decided to use generator by alex23, as it seems
simple, short and understandable. Still reading this thread was quite
interesting, thanks :-)
--
Filip Gruszczyński
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 13 Dec 2008 02:58:48 -0800, a_olme wrote:
> On 13 Dec, 10:38, "Martin v. Löwis" wrote:
>> > When I try to use umlauts in idle it will only print out as Unicode
>> > escape characters. Is it possible to configure idle to print them as
>> > ordinary characters?
>>
>> Did you really use the
I have a future statement in a script which is intended to work in 2.6 and 3.
Shouldn't compile flags in __future__ objects essentially be noops for versions
that already support the feature? doctest is complaining about unrecognised
flags. This illustrates the problem:
Python 3.0 (r30:67507,
On Sat, 13 Dec 2008 02:20:59 +0100, Hrvoje Niksic wrote:
> Saner (in this respect) behavior in the tuple example would require a
> different protocol. I don't understand why Python doesn't just call
> __iadd__ for side effect if it exists. The decision to also rebind the
> result of __i*__ metho
On Fri, 12 Dec 2008 19:02:24 -0500, Terry Reedy wrote:
> Tim Chase wrote:
>>> If you want to literally remove None objects from a list(or
>>> mutable sequence)
>>>
>>> def deNone(alist):
>>>n=len(alist)
>>>i=j=0
>>>while i < n:
>>> if alist[i] is not None:
>>>alist[j]
On 13 Dec, 10:38, "Martin v. Löwis" wrote:
> > When I try to use umlauts in idle it will only print out as Unicode
> > escape characters. Is it possible to configure idle to print them as
> > ordinary characters?
>
> Did you really use the print statement? They print out fine for me.
>
> Regards,
I forgot to return target:
def guess(player, p1score, p2score):
target = None
guess1 = int(input("\n>> "))
if guess1 > 100:
print("ONLY NUMBERS FROM 1 TO 99")
elif guess1 > target:
print("TOO HIGH")
elif guess1 == target:
print("GOOD JOB, PLAYER %s! THE SCORE IS:" % player)
James Stroud wrote:
1. Refactor. You should look at your code and see where you repeat the
same or similar patterns, see where they differ, make functions, and
make the differences parameters to the function call:
def guess(player, p1score, p2score):
guess1 = int(input("\n>> "))
if guess1
1 - 100 of 105 matches
Mail list logo