Steven D'Aprano wrote:
class Parrot:
def __init__(self, *args):
print "Initialising instance..."
if __debug__:
self.verify() # check internal program state, not args
if __debug__:
def verify(self):
print "Verifying..."
+1 It looks good to
Gabriel Genellina wrote:
(Pipes don't work the same as sockets, although unix-like systems try
hard to hide the differences...)
BSD-based unixes implement pipes using socketpair(), so
pipes actually *are* sockets (or at least they used to be,
not sure whether it's still true).
--
Greg
--
htt
On Dec 13, 6:03 am, Steve Holden wrote:
> 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
On Sun, 14 Dec 2008 07:41:55 +, Steven D'Aprano wrote:
> 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 fal
On Sun, Dec 14, 2008 at 3:47 PM, Henson wrote:
> 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?
No this hasn't changed. This is the string you need
to check for. It doe
On Sun, 14 Dec 2008 09:19:45 +, Marc 'BlackJack' Rintsch wrote:
> class Parrot:
> def __init__(self, *args):
> print "Initialising instance..."
> assert self.verify()
Here I meant ``assert self._verify()`` of course.
> def _verify(self):
> print "Verifying..."
On Sun, 14 Dec 2008 06:48:19 +0100, Piotr Sobolewski wrote:
> Then I tried to do this that way:
> sys.stdout = codecs.getwriter("utf-8")(sys.__stdout__)
> s = u"Stanisław Lem"
> print u
> This works but is even more combersome.
>
> So, my question is: what is the official, recommended Python way?
Marc 'BlackJack' Rintsch wrote:
> I'd make that first line:
> sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
>
> Why is it even more cumbersome to execute that line *once* instead
> encoding at every ``print`` statement?
Oh, maybe it's not cumbersome, but a little bit strange - but sure, I c
'Dive into Python' has a very memorable and interesting section on the
exact behaviour of 'and' and 'or' in Python:
http://diveintopython.org/power_of_introspection/and_or.html
> No: &, | (and ^, too) perform bitwise operations in Python, C and Java:
"In complete evaluation ... both expressions
On Sat, 13 Dec 2008 at 23:05, Neal Becker wrote:
How would I use suprocess to do the equivalent of:
cat - | program_a | program_b
Have you tried extending the pipe example from the manual?
http://docs.python.org/library/subprocess.html#replacing-shell-pipeline
--David
--
http://mail.python.o
On Sun, 14 Dec 2008 09:19:45 +, Marc 'BlackJack' Rintsch wrote:
> On Sun, 14 Dec 2008 07:41:55 +, Steven D'Aprano wrote:
>
>> 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
On Dec 11, 8:03 pm, bobicanprogram wrote:
> Problem:
>
> Apache server serving an HTML file to a Firefox Browser containing a
> form and
> a CGI python CGI script. HTML works fine, meat of the CGI script works
> fine
> except that when a home grown and ordinarily functional module that is
> to be
Steven D'Aprano writes:
> On Sun, 14 Dec 2008 10:52:25 +, Arnaud Delobelle wrote:
>
>> You could also not use the metaclass and use post_verify as a decorator
>
> Except that self.verify doesn't exist if __debug__ is false.
OK I wrote this as an afterthought. I'm, sure it's not beyond your
On Dec 13, 10:09 pm, MRAB wrote:
> 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 pr
On Dec 14, 4:10 am, "Gabriel Genellina"
wrote:
> daemon became a property in Python 2.6; setDaemon was the only way to set
> it in previous versions.
I thought that might be the case! The documentation is a bit vague:
http://docs.python.org/library/threading.html?highlight=threading#threading.Th
On Dec 14, 2:40 am, Brian Allen Vanderburg II
wrote:
> But what I think it means is that during the listen for an incoming
> connection on the listening socket, if multiple connection attempts are
> coming in at one time it can keep a backlog of up to 5 of these
> connection attempts for that indi
Steven D'Aprano writes:
> 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
Hi
I'm trying to wrap a c library for use with Python 2.6.
I'm using swig 1.3.36, and I get the following error:
linux-python/log_wrap.c: In function '_PySwigObject_type':
linux-python/log_wrap.c:1680: warning: missing initializer
linux-python/log_wrap.c:1680: warning: (near initialization for
'
On Dec 14, 4:48 am, "Gabriel Genellina"
wrote:
> - you have to close server.stdin when you don't have more data to send.
> The server will see an end-of-file and knows it has to exit the loop.
> Same thing on the client side.
Hi Gabriel, thanks for modifying the code to make it work. I've just
tr
On Sun, 14 Dec 2008 10:52:25 +, Arnaud Delobelle wrote:
> You could also not use the metaclass and use post_verify as a decorator
Except that self.verify doesn't exist if __debug__ is false.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
Hi.
r wrote:
> These are just the kind of things that make Python so beautiful ;)
> Thanks Guido!
You shouldn't forget to thank K&R ;-)
Shortcutting logical operation shortcuts existed already in C and has
been adopted by quite a lot of programming languages.
bye
N
--
http://mail.python.org/
Steven D'Aprano writes:
> 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
Carl Banks wrote in
news:69d2698a-6f44-4d85-adc3-1180ab158...@r15g2000prd.googlegroups.com:
> Unless you are referring to some wget screen mode I don't know about,
> I suspect wget outputs its progress bar using carriage returns
> without newlines. If that's all you want, there is no need to us
Hello,
Now that Lua [1] appears as a native scripting language in more [2]
and more [3] mainstream web servers, here is an example of a web
server written in Lua:
http://svr225.stepx.com:3388/a
The wiki demo sports content from the 2008/9 Wikipedia Selection,
containing about 5500 articl
#!/usr/bin/python
#Py3k, UTF-8
import random
def setup():
#global target, guess, a, b
#a, b make minimum, maximum. Can be adjusted.
a, b = 1, 99
target = random.randint(a, b)
return a, b, target
def playerswitch(player):
#Player Switch
#if player's a witch, burn her!
Is it possible to re-encode a string to a different character set in
python? To be more specific, I want to change a text file encoded in
windows-1251 to UTF-8.
I've tried using string.encode, but get the error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 0:
ordinal not in
John O'Hagan wrote:
> On Wed, 10 Dec 2008, badmuthahubbard wrote:
>> I've been trying to get the timing right for a music sequencer using
>> Tkinter. First I just loaded the Csound API module and ran a Csound
>> engine in its own performance thread. The score timing was good,
>> being controlled
On Dec 14, 2008, at 9:21 AM, Daniel Woodhouse wrote:
Is it possible to re-encode a string to a different character set in
python? To be more specific, I want to change a text file encoded in
windows-1251 to UTF-8.
I've tried using string.encode, but get the error:
UnicodeDecodeError: 'ascii' c
On 2008-12-14, Daniel Fetchinson wrote:
> 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.
Short circuit evaluation of booleans is very common (and has
been for decades), so I don't know
Rohannes wrote:
'Dive into Python' has a very memorable and interesting section on the
exact behaviour of 'and' and 'or' in Python:
http://diveintopython.org/power_of_introspection/and_or.html
No: &, | (and ^, too) perform bitwise operations in Python, C and Java:
"In complete evaluation ...
Hi guys,
#! /usr/bin/python
import random
import bucket2
data = [ random.randint(1,25) for i in range(5)]
print "random data : %s" % data
print "result: %s" %bucket2.sort(data)
How to write a test script which will outputs execution time for
bucket2.sort(data) ?
Thanks in advance!
--
http://ma
I'm translating some code from another language (Lua) which has
multiple function return values. So, In Lua, it's possible to define a
function
function f()
return 1,2,3
end
which returns 3 values. These can then be used/assigned by the caller:
a,b,c = f()
So far, much like
Daniel Fetchinson wrote:
[ ... ]
> 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.
There are a lot of threads on comp.lang.python that mention beginners'
possible reactions to language fe
Grant Edwards wrote:
> Short circuit evaluation of booleans is very common (and has
> been for decades), so I don't know why people would expect
> something else.
Visual Basic ;)
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Dec 14, 2008 at 2:38 AM, Gabriel Genellina
wrote:
> 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
Paul Moore a écrit :
I'm translating some code from another language (Lua) which has
multiple function return values. So, In Lua, it's possible to define a
function
function f()
return 1,2,3
end
which returns 3 values. These can then be used/assigned by the caller:
a,b,c =
David Hláčik a écrit :
Hi guys,
#! /usr/bin/python
import random
import bucket2
data = [ random.randint(1,25) for i in range(5)]
print "random data : %s" % data
print "result: %s" %bucket2.sort(data)
How to write a test script which will outputs execution time for
bucket2.sort(data) ?
http:
Grant Edwards a écrit :
On 2008-12-14, Daniel Fetchinson wrote:
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.
Short circuit evaluation of booleans is very common (and has
been for dec
feba a écrit :
#!/usr/bin/python
#Py3k, UTF-8
import random
def startup():
print("WELCOME TO THE SUPER NUMBER GUESSING GAME!")
global pnum, play, player, p1sc, p2sc
You should now try to rewrite the whole thing to avoid using globals.
pnum = int(input("1 OR 2 PLAYERS?\n> "))
W
I stumbled across a thread about that suggests fixing deepcopy to let it
copy slice objects. (
http://mail.python.org/pipermail/python-list/2006-August/398206.html). I
expected this to work and don't see any reason why it shouldn't in case
there is a good reason why it dosen't work can someone plea
On Sun, Dec 14, 2008 at 05:03:38PM +0100, David Hláčik wrote:
> Hi guys,
>
> #! /usr/bin/python
>
> import random
> import bucket2
>
> data = [ random.randint(1,25) for i in range(5)]
> print "random data : %s" % data
> print "result: %s" %bucket2.sort(data)
>
> How to write a test script which
On 14 Dec, 16:22, Bruno Desthuilliers
wrote:
> if you only want the first returned value, you can just apply a slice:
>
> def f():
> return 1,2,3
>
> a = f()[0] + 1
Hmm, true. I'm not sure it's any less ugly, though :-)
> FWIW, Python 2.6 has NamedTuple objects...
I know, but I want to targ
Bruno Desthuilliers wrote:
[...]
> if you only want the first returned value, you can just apply a slice:
>
> def f():
>return 1,2,3
>
> a = f()[0] + 1
>
That isn't a slice, it's indexing
regards
Steve
--
Steve Holden+1 571 484 6266 +1 800 494 3119
Holden Web LLC ht
feba a écrit :
#!/usr/bin/python
#Py3k, UTF-8
import random
def setup():
#global target, guess, a, b
#a, b make minimum, maximum. Can be adjusted.
a, b = 1, 99
target = random.randint(a, b)
return a, b, target
Seems ok. You may want to use arguments with default values for
I've looked at traceback module but I can't find how to limit traceback
from the most recent call if it is possible. I see that extract_tb has
a limit parameter, but it limits from the start and not the end.
Currently I've made my own traceback code to do this but wonder if
python already has
On Dec 14, 5:52 am, Karlo Lozovina <_kar...@_mosor.net_> wrote:
> Carl Banks wrote
> innews:69d2698a-6f44-4d85-adc3-1180ab158...@r15g2000prd.googlegroups.com:
>
> > Unless you are referring to some wget screen mode I don't know about,
> > I suspect wget outputs its progress bar using carriage ret
On 14 Des, 05:46, "Martin v. Löwis" wrote:
>
> Yes. If you want a display that is guaranteed to work on your terminal,
> use the ascii() builtin function.
But shouldn't the production of an object's representation via repr be
a "safe" operation? That is, the operation should always produce a
resu
I am trying to build Python from source on a RHEL system where I do
not have root access. There are two modules that I am having trouble
with: zlib & binascii.
zlib -- This seems like a make configuration issue. I have noticed
that 'gcc -v' returns '--with-system-zlib':
$ gcc -v
Using built-in s
Peter Otten wrote:
> That's none of __future__'s business, I think. Python offers a hook which
> you can modify:
>
import sys, traceback
from functools import partial
sys.excepthook = partial(traceback.print_exception, limit=5)
I just stumbled upon
>>> import sys
>>> sys.tracebac
Any special reasons?
Because it is there (at least on my Debian box)?
But not on windows :(
import time
time.strftime("%e")
''
Guess you'll have to take it up with the authors of strftime() at
Microsoft :)
The full set of format codes supported varies across
platforms, because Python
Hi,
in a package i'd like to have a structure like this:
Files end with ".py", others are directories:
mod
__init__.py # sets __all__ = ['smod1']
smod1.py # contains AClass()
smod1
__init__.py # sets __all__ = ['abc', 'def']
abc.py
def.py
So i can now do:
i
Steve Holden a écrit :
Bruno Desthuilliers wrote:
[...]
if you only want the first returned value, you can just apply a slice:
def f():
return 1,2,3
a = f()[0] + 1
That isn't a slice, it's indexing
Yeps, sorry - and thanks for the correction.
--
http://mail.python.org/mailman/listinfo/p
On Sun, Dec 14, 2008 at 3:16 PM, Torsten Mohr wrote:
> Hi,
>
> in a package i'd like to have a structure like this:
>
> Files end with ".py", others are directories:
>
> mod
> __init__.py # sets __all__ = ['smod1']
> smod1.py # contains AClass()
> smod1
>__init__.py # se
Torsten Mohr writes:
> Hi,
>
> in a package i'd like to have a structure like this:
>
> Files end with ".py", others are directories:
>
> mod
> __init__.py # sets __all__ = ['smod1']
> smod1.py # contains AClass()
> smod1
> __init__.py # sets __all__ = ['abc', 'def']
>> I wonder how i can make AClass() known in that package.
>>
>
> Why don't you put the contents of smod1.py in mod/smod1/__init__.py?
> It'll work this way.
Of course, thanks for that hint.
Best regards,
Torsten.
--
http://mail.python.org/mailman/listinfo/python-list
Thank you guys for help and support! My homework is done and waiting
for grading.
Here it comes - bucket sort with time complexity O(n) == linear complexity
#! /usr/bin/python
def sort(numbers):
"sort n positive integers in O(n) provided that they are all from
interval [1, n^2]"
> But shouldn't the production of an object's representation via repr be
> a "safe" operation?
It's a trade-off. It should also be legible.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
En Sun, 14 Dec 2008 11:00:18 -0200, Emanuele D'Arrigo
escribió:
On Dec 14, 4:10 am, "Gabriel Genellina"
wrote:
daemon became a property in Python 2.6; setDaemon was the only way to
set
it in previous versions.
I thought that might be the case! The documentation is a bit vague:
http://d
I'm running python in IDLE on suse11.
I have a python program and after writing 100kB to 200kB to a file,
the write statements seem to stop working.
Basically the print statements look like this:
some loops:
logFile.write(string1)
logFile.write(string2)
end of loops
print(stringA)
logFile.write(
On Sat, 13 Dec 2008 19:17:41 +, 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
En Sun, 14 Dec 2008 09:37:38 -0200, Emanuele D'Arrigo
escribió:
On Dec 14, 4:48 am, "Gabriel Genellina"
wrote:
- you have to close server.stdin when you don't have more data to send.
The server will see an end-of-file and knows it has to exit the loop.
Same thing on the client side.
Hi Ga
Steven D'Aprano wrote:
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
> I will try the python program outside of IDLE.
Yes, running the program from the Linux shell instead of from IDLE
produces all output correctly.
Now I'll have to look for a new simple development environment :-(
I think I'll try SPE that has worked well for me ...
--
http://mail.python.org/mail
> Target: x86_64-redhat-linux
> gcc -pthread -shared build/temp.linux-x86_64-2.5/location/of/
> Python-2.5.2/Modules/zlibmodule.o -L/usr/local/lib -lz -o build/
> lib.linux-x86_64-2.5/zlib.so
> /usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for
> -lz
Do
file /usr/lib/libz.so
On Sun, 2008-12-14 at 11:16 +0100, Piotr Sobolewski wrote:
> Marc 'BlackJack' Rintsch wrote:
>
> > I'd make that first line:
> > sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
> >
> > Why is it even more cumbersome to execute that line *once* instead
> > encoding at every ``print`` statement?
Piotr Sobolewski writes:
> in Python (contrary to Perl, for instance) there is one way to do
> common tasks.
More accurately: the ideal is that there should be only one *obvious*
way to do things. Other ways may also exist.
> Could somebody explain me what is the official python way of
> printi
On Dec 14, 4:54 pm, "Martin v. Löwis" wrote:
> > Target: x86_64-redhat-linux
> > gcc -pthread -shared build/temp.linux-x86_64-2.5/location/of/
> > Python-2.5.2/Modules/zlibmodule.o -L/usr/local/lib -lz -o build/
> > lib.linux-x86_64-2.5/zlib.so
> > /usr/bin/ld: skipping incompatible /usr/lib/libz.
On Dec 14, 5:03 pm, "peter s." wrote:
> On Dec 14, 4:54 pm, "Martin v. Löwis" wrote:
>
>
>
> > > Target: x86_64-redhat-linux
> > > gcc -pthread -shared build/temp.linux-x86_64-2.5/location/of/
> > > Python-2.5.2/Modules/zlibmodule.o -L/usr/local/lib -lz -o build/
> > > lib.linux-x86_64-2.5/zlib.s
> So.. it seems as though I need to get it to point to the 64 bit
> version (or compile the zlib that comes with Python source). I'm not
> sure how to override that.
The easiest solution would be to invoke the linker line manually,
and replace -lz with the absolute path to the right library.
Reg
On Sun, 14 Dec 2008 09:51:03 -0800, Paul Moore wrote:
> On 14 Dec, 16:22, Bruno Desthuilliers
> wrote:
>> if you only want the first returned value, you can just apply a slice:
>>
>> def f():
>> return 1,2,3
>>
>> a = f()[0] + 1
>
> Hmm, true. I'm not sure it's any less ugly, though :-)
>
On Dec 14, 5:51 pm, Paul Moore wrote:
> On 14 Dec, 16:22, Bruno Desthuilliers
>
> wrote:
> > if you only want the first returned value, you can just apply a slice:
>
> > def f():
> > return 1,2,3
>
> > a = f()[0] + 1
>
> Hmm, true. I'm not sure it's any less ugly, though :-)
>
> > FWIW, Pyth
> That's an interesting definition of crash. You're just like saying: "C
> has crashed because I made a bug in my program". In this context, it is
> your program that crashes, not python nor C, it is misleading to say so.
>
> It will be python's crash if:
> 1. Python 'segfault'ed
> 2. Python inter
On Mon, Dec 15, 2008 at 9:03 AM, Fuzzyman wrote:
> It seems to me to be a generally accepted term when an application
> stops due to an unhandled error to say that it crashed.
it == application
Yes.
#!/usr/bin/env python
from traceback import format_exc
def foo():
print
It looks much better. But as Bruno suggests and as I alluded to earlier,
you should get in the habit of forming verification loops on input
channels that aren't already guaranteed to provide valid input messages.
I'm not sure how to say that in English, but in python my example was:
while True
> My main problem is that when I use some language I want to use it the way it
> is supposed to be used. Usually doing like that saves many problems.
> Especially in Python, where there is one official way to do any elementary
> task. And I just want to know what is the normal, official way of prin
MicroWar 2.0 alpha 3 for test purpose
Download : http://microwar.sourceforge.net/
Presentation
-
MicroWar is "Space Invaders" style arcade game, in the cruel world of
micro-compter industry. You're a Macintosh faced to invading Wintel
hordes year after year, kill more PC.
Bonuses
On 14 Des, 22:13, "Martin v. Löwis" wrote:
> > But shouldn't the production of an object's representation via repr be
> > a "safe" operation?
>
> It's a trade-off. It should also be legible.
Right. I can understand that unlike Python 2.x, a representation of a
string in Python 3.x (whose equivale
Paul Moore wrote:
I'm translating some code from another language (Lua) which has
multiple function return values. So, In Lua, it's possible to define a
function
function f()
return 1,2,3
end
which returns 3 values. These can then be used/assigned by the caller:
a,b,c = f()
> It's unfortunate that the default behaviour isn't
> optimal at the interactive prompt for some configurations, though.
As I said, it's a trade-off. The alternative, if it was the default,
wouldn't be optimal at the interactive prompt for some other
configurations.
In particular, users of non-la
On Dec 14, 6:32 am, bobicanprogram wrote:
> On Dec 13, 10:09 pm, MRAB wrote:
>
>
>
> > 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.
Lie Ryan wrote:
"You know what you just did? You've
just found a problem that was supposed to be an example of unsolvable
problem."
It has happened before, why not again?
There's a big difference between an unsolvable problem and an
unsolved problem. In the cases you're talking about, nobody
On Dec 13, 9:09 pm, MRAB wrote:
> 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 pro
uair01 wrote:
I will try the python program outside of IDLE.
Yes, running the program from the Linux shell instead of from IDLE
produces all output correctly.
Now I'll have to look for a new simple development environment :-(
I think I'll try SPE that has worked well for me ...
Or you could t
On Dec 14, 6:04 pm, greg wrote:
> Lie Ryan wrote:
> > "You know what you just did? You've
> > just found a problem that was supposed to be an example of unsolvable
> > problem."
>
> > It has happened before, why not again?
>
> There's a big difference between an unsolvable problem and an
> unsolve
James Stroud wrote:
py> class mytuple(tuple):
def magic(self, astr):
names = astr.split()
for name, val in zip(names, self):
globals()[name] = val
...
py> t = mytuple((1,2,3))
py> t.magic('a b')
py> a
1
py> b
2
James
In case its not obvious:
def f():
return mytuple((1,2,3))
I just saw an interesting post --
The video linked to on http://www.blog.wired.com in Kim Zetter's
"Threat Level" blog, there is a video describing the software
used to provide open access to ballots after an election. The
software used for this system is an open-source system written
in Python.
On Dec 14, 11:19 am, Paul Moore wrote:
> I'm translating some code from another language (Lua) which has
> multiple function return values. So, In Lua, it's possible to define a
> function
>
> function f()
> return 1,2,3
> end
>
> which returns 3 values. These can then be used/ass
drobi...@gmail.com wrote:
I'm baffled by this discussion.
What's wrong with
a, dontcare, dontcare2 = f()
a = a + 1
Simple, clear, and correct.
1. This can't apply to a generalized f() that may return an arbitrary
number of arguments >= len(num_assignments_you_care_about).
2. The examp
James Stroud wrote:
inspect.stack()[1][0].f_locals[name] = val
I just double checked this. Because of the way locals are implemented in
cPython, this won't have the desired affect.
James
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 14 Dec 2008 21:42:33 +, Lie Ryan wrote:
> I'm sure someday, there will be a student who comes to class late and
> sees this on the board: "Design a comparison sorting algorithm that has
> better than O(n * log n) lower bound complexity." The unsuspecting
> student copied it, thinking i
On 2008-12-12, Filip Gruszczyński wrote:
> Hi!
>
> I would like to iterate over a sequence nad ignore all None objects.
> The most obvious way is explicitly checking if element is not None,
> but it takes too much space. And I would like to get something faster.
> I can use
> [ sth for sth in self
On 2008-12-12, Nick Craig-Wood wrote:
> Failing that I'll use bdist_rpm then alien to convert to a deb which
> works well enough I find.
Ages ago there was a bdist_deb that was in the python bug tracker, long
since that bug tracker has been transitioned to another one, and that
attachment was lost
On Sun, 14 Dec 2008 18:35:24 +0100, Andreas Kostyrka wrote:
> On Sun, Dec 14, 2008 at 05:03:38PM +0100, David Hláčik wrote:
>> Hi guys,
>>
>> #! /usr/bin/python
>>
>> import random
>> import bucket2
>>
>> data = [ random.randint(1,25) for i in range(5)] print "random data :
>> %s" % data
>> pri
On Fri, 12 Dec 2008 22:55:20 +, Steven D'Aprano wrote:
> On Fri, 12 Dec 2008 21:18:36 +, Lie Ryan wrote:
>> Personally, I'd prefer VB's version:
>> foo IsNot bar
>>
>> or in pseudo-python
>> foo isnot bar
>>
>> since that would make it less ambiguous.
>
> "a is not b" is no more ambiguo
Steven D'Aprano wrote:
> All the positive thinking in the world won't help you:
>
> * make a four-sided triangle;
>
> * split a magnet into two individual poles;
These two are fundamentally different problems.
The first is impossible by definition. The definition of triangle is, "a
three-si
Hi all, this is just a brief announcement regarding the resurrection
of the Python User Group in Calgary, Alberta, Canada.
Our first meeting will be on Wednesday, January 14, 2009.
Our official web site (albeit requiring a lot of work):
http://www.pythoncalgary.com/
We have a mailing list set up
On Mon, 15 Dec 2008 02:11:10 +, Lie Ryan wrote:
>> So given the normal precedence rules of Python, there is no ambiguity.
>> True, you have to learn the rules, but that's no hardship.
>
> *I* know about the precedence rule, but a newbie or a tired programmer
> might not. He might want to reve
On Sun, 14 Dec 2008, Bad Mutha Hubbard wrote:
> John O'Hagan wrote:
> > On Wed, 10 Dec 2008, badmuthahubbard wrote:
[...]
> > from time import time, sleep
> >
> > start = time()
> > for event in music:
> > duration=len(event) #Really, the length of the event
> > play(event)
> > while 1:
On Dec 9, 10:48 pm, excor...@gmail.com wrote:
>
> Anyway, the direction I'm heading is to try and use setuptools *less*.
> It seems like it might be too complicated for me. And, I notice that
> the mailing list for it (distutils-sig, if that's the right one) is
> loaded with questions on how to use
hahaha, do you know how much money they are spending on hardware to
make
youtube.com fast???
> By the way... I know of a very slow Python site called YouTube.com. In
> fact, it is so slow that nobody ever uses it.
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 123 matches
Mail list logo