On 23-03-2023 13:33, Barry Scott wrote:
On 23 Mar 2023, at 08:46, Arnaud Loonstra wrote:
Hi all,
I'm running in a crash due to a ResourceWarning (some socket is not closed in a
used module) after calling PyGILState_Release.
I'm running Python in a native thread (so a thread cr
e_Release is called again.
(7) while I've already called it (126).
I can make the crash go away by adding
import warnings
warnings.simplefilter("ignore", ResourceWarning)
to my python code. But I'd rather prevent this from happening in the
first place.
Any suggestion ver
On 24-11-2021 01:46, MRAB wrote:
On 2021-11-23 20:25, Arnaud Loonstra wrote:
On 23-11-2021 18:31, MRAB wrote:
On 2021-11-23 16:04, Arnaud Loonstra wrote:
On 23-11-2021 16:37, MRAB wrote:
On 2021-11-23 15:17, MRAB wrote:
On 2021-11-23 14:44, Arnaud Loonstra wrote:
On 23-11-2021 15:34, MRAB
On 23-11-2021 18:31, MRAB wrote:
On 2021-11-23 16:04, Arnaud Loonstra wrote:
On 23-11-2021 16:37, MRAB wrote:
On 2021-11-23 15:17, MRAB wrote:
On 2021-11-23 14:44, Arnaud Loonstra wrote:
On 23-11-2021 15:34, MRAB wrote:
On 2021-11-23 12:07, Arnaud Loonstra wrote:
Hi,
I've got P
On 23-11-2021 16:37, MRAB wrote:
On 2021-11-23 15:17, MRAB wrote:
On 2021-11-23 14:44, Arnaud Loonstra wrote:
On 23-11-2021 15:34, MRAB wrote:
On 2021-11-23 12:07, Arnaud Loonstra wrote:
Hi,
I've got Python embedded successfully in a program up until now as I'm
now running int
On 23-11-2021 15:34, MRAB wrote:
On 2021-11-23 12:07, Arnaud Loonstra wrote:
Hi,
I've got Python embedded successfully in a program up until now as I'm
now running into weird GC related segfaults. I'm currently trying to
debug this but my understanding of CPython limits me here
On 23-11-2021 13:07, Arnaud Loonstra wrote:
Hi,
I've got Python embedded successfully in a program up until now as I'm
now running into weird GC related segfaults. I'm currently trying to
debug this but my understanding of CPython limits me here.
I'm creating a Tuple in
onactor.c862 0x5568e472
19 pythonactor_handlerpythonactor.c828 0x5568e2e2
20 sphactor_actor_run sphactor_actor.c 855 0x558cb268
...
Any pointer really appreciated.
Rg,
Arnaud
--
https://mail.python.org/mailman/listinfo/python-list
On 31-10-2019 15:39, Arnaud Loonstra wrote:
On 31-10-2019 14:44, Thomas Jollans wrote:
On 31/10/2019 14.13, Arnaud Loonstra wrote:
On 30-10-2019 09:32, Arnaud Loonstra wrote:
Hi all,
I'm trying to wrap my head around the ctypes API. I have a C
structure I wish to create in Python and
On 31-10-2019 14:44, Thomas Jollans wrote:
On 31/10/2019 14.13, Arnaud Loonstra wrote:
On 30-10-2019 09:32, Arnaud Loonstra wrote:
Hi all,
I'm trying to wrap my head around the ctypes API. I have a C
structure I wish to create in Python and then return from python to C.
So a python meth
On 30-10-2019 09:32, Arnaud Loonstra wrote:
Hi all,
I'm trying to wrap my head around the ctypes API. I have a C structure I
wish to create in Python and then return from python to C.
So a python method is called from C and needs to return an object which
we then process in C again
;"
[super class] ""
[meta type] ""
ob_refcnt 1 Py_ssize_t
However how I can I get it back to the original C type (zmsg_t *)
Any help really appreciated.
Rg,
Arnaud
--
https://mail.python.org/mailman/listinfo/python-list
Python is build with the following flags:
./configure --prefix
$HOME/openFrameworks/apps/devApps/$APPNAME/bin/python --disable-shared
--with-openssl=$(brew --prefix openssl);
Anybody any pointers or advice?
Rg,
Arnaud
--
https://mail.python.org/mailman/listinfo/python-list
;d still go for hashfile
for the function name though.
--
Arnaud
--
https://mail.python.org/mailman/listinfo/python-list
ts, any thoughts about that?
* Fix the code in ZODB to not avoid import but to me this seems like a
dirty hack because it could happen again and I would prefer to fix
this issue once and for all.
Any thoughts or suggestion welcome, thanks!
Regards,
--
Arnaud Fontaine
[0] http://bugs.python.o
ts, any thoughts about that?
* Fix the code in ZODB to not avoid import but to me this seems like a
dirty hack because it could happen again and I would prefer to fix
this issue once and for all.
Any thoughts or suggestion welcome, thanks!
Regards,
--
Arnaud Fontaine
[0] http://bugs.python.o
's a tradeoff.
OTOH Twisted can handle much more than socket programming. On the
third hand Twisted has its own learning curve as well...
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
o ' + str(miles) + 'miles.')
>>
>> poop = MyGui()
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>
> poop? Seriously? You aren’t serious about that copying, right?
>
> Your code seems to be missing a lot of important stuff. You don’t
> inherit from tkinter.Frame. Compare your program to the sample “Hello
> world!” program:
His class is not a frame, it's just a container for the tkinter code.
It's a bit unusual but it looks correct to me (apart from the single
underscores in __init__() as spotted by Ned Batchelder).
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
MyObject(metaclass=MyType):
pass
>>> class Test(MyObject):
... def __metaclass__(name, bases, attrs):
... print("Test metaclass")
... return MyType(name, bases, attrs)
...
Test metaclass
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
on
this list was answered by Alex Martelli and nowadays I get most
excellent and concise tips from Peter Otten - thanks, Peter! If
there's one person on this list I don't want to offend, it's you!
So here's to lots more good and bad humour on this list, and the
occasional slightly un-pc remark even!
Cheers,
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
'colspan="2" {{Version |o |13 April 2007}}',
'2.6.12'],
['[[Ubuntu 6.06|6.06 LTS]]',
'Dapper Drake',
'1 June 2006',
'{{Version |o | 14 July 2009}}',
'{{Version |o | 1 June 2011}}',
'2.6.15'],
['[[Ubuntu 6.10|6.10]]',
'Edgy Eft',
'26 October 2006',
'colspan="2" {{Version |o | 25 April 2008}}',
'2.6.17'],
[...]
]
>>>
That should give you the info you need (until the wiki page changes too much!)
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
ou come in contact with. Therefore, my
suggestion is that you stay clear of any computer equipment from now
on, as you may cause hazards for yourself and others.
Others may be able to elaborate further.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
;>> foo.boo(1)
Foo1.boo 1
Foo1.bar
>>> far = Far1()
>>> far.bar()
Foo1.bar
>>> far.boo(0)
DifferentBoo.boo 0
Foo1.boo 0
Foo1.bar
>>> far.boo(1)
DifferentBoo.boo 1
Foo1.bar
HTH,
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
[1, 2]
You might be interested in code.compile_command()
(http://docs.python.org/2/library/code.html)
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
hich
outputs the song "99 bottles of beer":
http://codegolf.com/99-bottles-of-beer
Cheers,
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
also not the best in terms of time
or space complexity. Does this mean you have to write tests for time
and space complexity as well? That's interesting, but I don't know of
tools to help do that (time complexity seems easy enough, but space
complexity seems tougher to me).
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 7 April 2013 21:38, Nick Gnedin wrote:
>
> Arnaud,
>
> Thanks for the answer. I understand that I cannot access the docstring as an
> attribute of a getter, but what did you mean when you said "You need to do
> it from the class"? I am still confused - is there a wa
Python works. You won't be able to get the docstring
of a descriptor this way. You need to do it from the class. The
behaviour you observe is normal and cannot be overriden.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
t;>> sum(takewhile((100).__gt__, filter((2).__rmod__, map((2).__rpow__,
>>> count(1)
165
:)
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
l it manually
> return apply(self.to_binary, varargs, keys)
>
[...]
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
lse
You've fallen victim to the fact that CPython is very quick to collect
garbage. More precisely, when Python interprets `id(A.f) == id(a.f)`,
it does the following:
1. Create a new unbound method (A.f)
2. Calculate its id
3. Now the refcount of A.f is down to 0, so it's garbage co
return sum((getattr(p, 'mybits', []) for p in cls.mro()[::-1]),
[])
class Derived(Base):
mybits = ["value3", "value4"]
class FurtherDerived(Derived):
mybits = ["value5"]
>>> Derived.mylist()
['value1', 'value2', 'value3', 'value4']
>>> FurtherDerived.mylist()
['value1', 'value2', 'value3', 'value4', 'value5']
HTH
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
where you'd expect it (exit is a
constant, not a function):
http://docs.python.org/2/library/constants.html#constants-added-by-the-site-module
As for the behaviour when you pass a string, it's documented here:
http://docs.python.org/2/library/exceptions.html#exceptions.SystemExi
can name these alternatives (
'(?Ppattern)'). Then you can do
if m.group('case1'):
...
elif m.group('case2'):
...
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
d(lines):
... yield line
...
>>> print_pattern(mirror_pattern(generate_pretty_pattern()))
*
**
***
*
***
**
*
Here's another example:
>>> print_pattern(mirror_pattern(''.join(mirror_pattern("*".ljust(i).rjust(15)))
>>> for i in range(1,16,2)))
*
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
*
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
elf.var_a =
>
> @MyDecorator(...)
> def meth_one(self, in_data):
> ...
I don't really understand what you are trying to do. It would be
easier if you had some code that tried to do something (even if it
doesn't quite work).
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
tools import islice
>>> items = ['a', 'b', 'c', 'd', 'e', 'f', 'g']
>>> n = 3
>>> list(iter(lambda i=iter(items):list(islice(i, n)),[]))
[['a', 'b', 'c'], ['d', 'e', 'f'], ['g']]
Not too readable though :)
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
yping. The entered text will also
> need to be captured once the user has finished typing.
>
> This is a gui-less CLI tool for python 2.7
>
> I've seen some information on tty.setraw but I'm not sure how you'd go about
> wiring that up.
Can you use curses (http:/
On 21 March 2013 18:42, Christian Gollwitzer wrote:
> Am 21.03.13 15:37, schrieb Arnaud Delobelle:
>
>> Hi Python List,
>>
>> I'm trying to use PanedWindow on OS X (10.8.3). I've started with the
>> effbot docs example (http://effbot.org
="top pane")
m.add(top)
bottom = Label(m, text="bottom pane")
m.add(bottom)
mainloop()
--
I can see two panes alright, but no handle to resize them (or 'sash'
as they seem to be called in tkinter). Is there something else that I
should be doing?
TIA,
--
A
_eq__(self, other):
equal = self.obj == other
if equal:
self.lastequal = other
return equal
>>> yfinder = FindEqual(x)
>>> yfinder in S
True
>>> yfinder.lastequal is y
True
I've found y! I'm not happy with this as it really is a trick. Is
there a cleaner solution?
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
t;> def prefix(s):
... return sum(1 for c in takewhile(str.isdigit, s)) or 1000, s
...
>>> L = ['9', '1000', 'abc2', '55', '1', 'abc', '55a', '1a']
>>> sorted(L, key=prefix)
['1', '1a', '9', '55', '55a', '1000', 'abc', 'abc2']
Here's why it works:
>>> map(prefix, L)
[(1, '9'), (4, '1000'), (1000, 'abc2'), (2, '55'), (1, '1'), (1000,
'abc'), (2, '55a'), (1, '1a')]
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 31 October 2012 22:33, Steven D'Aprano
wrote:
[...]
> I don't killfile merely for posting from Gmail
And we are humbly grateful.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
itertools
>>> filenames = ["foo.png", "bar.csv", "foo.html", "bar.py"]
>>> dict((key, tuple(val)) for key, val in itertools.groupby(sorted(filenames),
>>> lambda f: os.path.splitext(f)[0]))
{'foo': ('foo.html', 'foo.png'), 'bar': ('bar.csv', 'bar.py')}
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 2 September 2012 19:42, Stefan Behnel wrote:
> Arnaud Delobelle, 02.09.2012 20:34:
>> On 2 September 2012 10:49, Arnaud Delobelle wrote:
>>> On 2 September 2012 10:39, Alec Taylor wrote:
>>>> http://pypi.python.org/pypi/lupa
>>>
>>> I'll che
On 2 September 2012 10:49, Arnaud Delobelle wrote:
> On 2 September 2012 10:39, Alec Taylor wrote:
>> http://pypi.python.org/pypi/lupa
>
> I'll check this out, thanks.
Mmh it seems to be lua 5.1 and more importantly it seems to require a
custom build of Python, which I don&
On 2 September 2012 10:39, Alec Taylor wrote:
> Or you can use a module made for this task:
>
> http://labix.org/lunatic-python
As I said in my original message, I couldn't get this to work.
> http://pypi.python.org/pypi/lupa
I'll check this out, thanks.
--
Arnaud
--
s to
be dormant.
My requirements are stock OS X Python (which is 2.7) and Lua 5.2. I'm
looking for either a way to make lunatic-python work or another tool
that would do the job.
Thanks in advance.
--
Arnaud
[1] http://labix.org/lunatic-python
--
http://mail.python.org/mailman/listinfo/python-list
On 1 September 2012 11:30, Peter Otten <__pete...@web.de> wrote:
> Arnaud Delobelle wrote:
>> It would be good if I could intercept the key press event and cancel its
>> action on the Entry widget. It's easy to intercept the key event, but I
>> haven'
the Entry widget input area. I've struggled to find good tkinter docs
on the web.
> caveat -- I've only written one simple form using Tkinter, so what
> do I know...
It's about as much as I've done!
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 31 August 2012 16:41, Alister wrote:
> On Fri, 31 Aug 2012 11:21:14 -0400, Kevin Walzer wrote:
>
>> On 8/31/12 11:18 AM, Arnaud Delobelle wrote:
>>
>>
>>> I'm not trying to do anything. When a user presses the UP or DOWN
>>> arrow, then a stran
On 31 August 2012 15:25, Kevin Walzer wrote:
> On 8/31/12 6:18 AM, Arnaud Delobelle wrote:
>>
>> I'm very inexperienced with Tkinter (I've never used it before). All
>> I'm looking for is a workaround, i.e. a way to somehow suppress that
>> output.
>
row, a
"\uf701" gets inserted.
I'm very inexperienced with Tkinter (I've never used it before). All
I'm looking for is a workaround, i.e. a way to somehow suppress that
output.
Thanks in advance,
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
r example:
for i in range(100):
for j in range(100):
do_something((i + N)%100, (j + N)%100)
Cheers,
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
seful to get feedback on unused imports / unused
variables / undefined variables (which means you spot typos on
variable names straight away).
For instructions, see e.g. http://www.plope.com/Members/chrism/flymake-mode
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
it: namely the field name.
Also it's hard to imagine a way to keep things readable when we don't
know what the original identifiers look like :)
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
nt ''.join(sorted(open(argv[1]), key=lambda l:
-int(l.split('\t')[0]))[:10 if len(argv) < 3 else int(argv[2])])
Who said Python was readabl'y yours,
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
up_Les_Gr=E8ves?=
>
> But the search function doesn't find my email, and I don't know why, even if
> I try with the entire string of the subject.
Can you post the code that doesn't work? It's hard to debug "search
function doesn't find my email". It would
s :)
This article makes me feel more positive about my inability to feel
comfortable in an IDE. Thanks for the link!
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 30 May 2012 12:54, Thomas Rachel
wrote:
> There is a 3rd one: use r'[ ' + '\u3000' + ']'. Not very nice to read, but
> should do the trick...
You could even take advantage of string literal concatenation:)
r'[' '\u3000' r
yet effective:
new_list = [(x, y + i) for x, y in coord_list for i in (-1, 1)]
IMHO these list comprehensions are often overlooked too quickly in
favour of itertools (in this case chain.from_iterable).
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
s me think of Lyndon words. A Lyndon word is a word which is
the only lexicographical minimum of all its rotations. There is a
very effective way of generating Lyndon words of length <= n. It may
be possible to adapt it to what you want (obviously as Lyndon words
are aperiodic you'd have t
rsistently. Another
> way that should work for any OS X universal Python 2.7.x:
>
> arch -i386 python2.7
This is what I have with system python 2.6:
$ cat ~/bin/python_32
#! /bin/bash
export VERSIONER_PYTHON_PREFER_32_BIT=yes
/usr/bin/python "$@"
I use it for wxpython, which only seems to work in 32 bit mode. I
can't remember where I found it. Maybe I read the man page?
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
.
I can't access it but it seems to me it's not about self sorted data
structures, which is what the OP is looking for.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
e','boy','cat' ### Output i want
> #
1. You can use a list comprehension
>>> [mydict[k] for k in 'a', 'b', 'c']
['apple', 'boy', 'cat']
2. You can use map (for python 3.X, you need to wrap this in list(...))
>>> map(mydict.__getitem__, ['a', 'b', 'c'])
['apple', 'boy', 'cat']
3. You can use operator.itemgetter
>>> from operator import itemgetter
>>> itemgetter('a', 'b', 'c')(mydict)
('apple', 'boy', 'cat')
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
Perhaps you would have better luck if you either post the actual code
> you want people to critique, or posted a link to that code.
He did post a link to a blog post describing his module and also a link to
the actual code, on bitbucket IIRC.
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
s long as __eq__
only relies on immutable state (and then so should __hash__ of course). A
typical example would be an object that does some caching.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
#x27;ve learnt a lot from your posts on this list
over the years, but too often you spoil it with your compulsion to
have the last word on every argument you get involved in at any cost.
Some arguments aren't worth winning...
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 17 April 2012 09:54, Bryan wrote:
> Django has emphasized backwards compatibility with the
> down-side that, last I heard, there was no plan to move to Python 3.
Not quite:
https://www.djangoproject.com/weblog/2012/mar/13/py3k/
--
Arnaud
--
http://mail.python.org/mailman/listinfo/
On 16 April 2012 13:29, Arnaud Delobelle wrote:
> You can do this (untested), but no doubt it won't be to everybody's taste:
>
> class A(object):
> def __init__(self):
> self.listing = []
>
> # This method does the work.
>
object):
def __init__(self):
self.listing = []
# This method does the work.
def append_text(self, text, style):
self.listing.append((text, style))
# The rest of the methods are just helpers.
for style in 'paragraph', 'header', 'title':
exec """def append_%s(self, text):
self.append_text(text, "%s")""" % (style, style.capitalize())
del style
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 13 April 2012 17:35, Kiuhnm wrote:
> On 4/13/2012 17:58, Alexander Blinne wrote:
>>
>> zip(*[x[1] for x in sorted(d.items(), key=lambda y: y[0])])
>
> Or
> zip(*[d[k] for k in sorted(d.keys())])
.keys() is superfluous here:
zip(*(d[k] for k in sorted(d
On 5 April 2012 21:06, Emile van Sebille wrote:
> Kind of begs for a contains method that returns the appropriate boolean:
>
> if text.contains('bob')
It's already there:
text.__contains__('bob')
It's usually spelt otherwise though:
'bob
On 22 March 2012 20:04, Rodrick Brown wrote:
>
> On Mar 22, 2012, at 3:53 PM, Arnaud Delobelle wrote:
> Try help(ste.strip)
>
> It clearly states "if chars is given and not None, remove characters in
> chars instead.
>
> Does it mean remove only the first occurrence
gt; if __name__ == '__main__':
>main()
>
> ./remove_str.py
> his is a es
> his is a tes
>
> Why wasnt the t removed ?
Try help(ste.strip)
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 19 March 2012 23:20, Ian Kelly wrote:
> I hope you don't mind if I critique your code a bit!
>
> On Fri, Mar 16, 2012 at 7:21 PM, Kiuhnm
> wrote:
>> Here we go.
>>
>> --->
>> def genCur(f, unique = True, minArgs = -1):
>
> It is customary in Python for unsupplied arguments with no default to
>
at span more
than one line. If the worst comes to the worst, I would write:
aptly_named_condition = (
very long condition
that goes over
plenty of lines
)
if aptly_named_condition:
do stuff
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 15 March 2012 00:27, Chris Angelico wrote:
> On Thu, Mar 15, 2012 at 10:54 AM, Arnaud Delobelle wrote:
>> I don't know this book and there may be a pedagogical reason for the
>> implementation you quote, but pairwise_sum is probably better
>> implemented i
2):
return [x1 + x2 for x1, x2 in zip(list1, list2)]
Or in Python 2.X:
from itertools import izip
def pairwise_sum(list1, list2):
return [x1 + x2 for x1, x2 in izip(list1, list2)]
Or even:
from operator import add
def pairwise_sum(list1, list2):
return map(add, list1, list2)
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 14 March 2012 22:15, Prasad, Ramit wrote:
> Only use 'is' if you are looking for objects like True,
> False, None or something that MUST be exactly the same object.
I've rarely seen valid uses of 'is True' or 'is False'.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
hey don't do the same thing :)
I suspect you meant:
for value in list:
if not value is another_value:
value.do_something()
break
I always feel uncomfortable with this because it's misleading: a loop
that never loops.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
http://docs.python.org/library/dbm.html) - it would be very easy to
do.
Or you could have your own custom solution where you scan the file and
build a dictionary mapping keys to file offsets, then when requesting
a dataset you can seek directly to the correct position.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 4, 2012 9:04 AM, "Sirotin Roman" wrote:
>
> Hi.
> How exactly jython decides is object callable or not? I defined
> __call__ method but interpreter says it's still not callable.
> BTW, my code works in cpython
It will help if you show us the code.
--
Arn
;.join(patternList))
if '_ ' not in patternList:
break
if '_ ' not in patternList:
print('SURELY you must be CHEATING, but you guessed my word in
' + str(i + 1) + ' tries!!!')
else:
bogusWord = pickWordFrom(L)
print('You lose. The word was: ' + bogusWord)
>>>
I haven't actually checked if this code runs :)
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
a, 2)
>
> This works, but I have to call sqr with a.sqr(a, 2), a.sqr(2) does not work
> (TypeError: sqr() takes exactly 2 arguments (1 given)).
I'm curious to know your motivation for doing this.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
; http://code.google.com/p/psutil/
>>
>> Cheers,
>> Chris
> Looked at that before. psutil doesn't do children.
>
> --mihai
Please don't top-post! Also, psutil.Process.get_children() looks to
me like it "does" children.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
On 26 February 2012 13:38, Wolfgang Meiners wrote:
> do_it = (len(str) <= maxlength) if maxlength is not None else True
That's a funny way to spell:
do_it = maxlength is None or len(str) <= maxlength
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
;for / break / else"
rather than "for / else".
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
n.
>
> Can anyone else confirm this as a bug?
>
> http://docs.python.org/py3k/library/turtle.html#demo-scripts
Just tested with Python 3.2.1 on Mac OS X 10.6.8 and all seems fine.
Perhaps if you say which platform it's failing on, others will be able
to reproduce the fai
On 23 February 2012 22:04, Chris Angelico wrote:
> On Fri, Feb 24, 2012 at 8:59 AM, Arnaud Delobelle wrote:
>> def sum(iterable, start=_sentinel, _sentinel=_sentinel):
>
> Is this a reason for Python to introduce a new syntax, such as:
>
> def foo(blah, optional=del):
&g
On 23 February 2012 21:53, Chris Angelico wrote:
> On Fri, Feb 24, 2012 at 8:41 AM, Arnaud Delobelle wrote:
>> _sentinel = object()
>>
>> def sum(iterable, start=_sentinel):
>> if start is _sentinel:
>>
>> del _sentinel
>
> Somewhat off-topic: Doe
try:
start = iterable.next()
except StopIteration:
return 0
for x in iterable:
start += x
return start
del _sentinel
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
why should sum() not be able to
> operate on that class?
It can. You need to pass a second argument which will be the start
value. Try help(sum) for details.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
wrapping all my logger.log() calls in try/except blocks, is
> there a way to skip logging to the HTTPhandler if the HTTP server is
> unavailable?
Here's one: subclass HTTPHandler :)
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
*() in python shell, error below happens
>
> File "", line 1
> *()
> ^
> SyntaxError: invalid syntax
It's worth reading the Python tutorial. Here's the relevant section:
http://docs.python.org/tutorial/controlflow.html#unpacking-argument-lists
You could read all of 4.7
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
ot? A lot of his/its
> posts look too intelligent to be computer-generated - or maybe I'm
> underestimating the quality of AI.
>
> I was wondering the exact same thing.
I think it may be that what you are underestimating is your ability,
as a human being, to create
quot;Both vulnerable",
]
CONDITIONS = [
(DEALERS[j], VULNERABILITIES[(i + j)%4])
for i in range(4) for j in range(4)
]
If you don't care about the order in which the conditions are listed,
you could use
CONDITIONS = itertools.product(DEALERS, VULNERABILITIES)
(But maybe you do, I haven't looked at the code)
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
e thought a couple of sentences here
>> http://www.python.org/about/help/ would be justified, what do y'all think?
>>
> help() is a built-in function, not a keyword.
I think he's referring to help *on* keywords, e.g.
>>> help('yield')
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
ht for all of us who have him in our
killfiles.
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list
on't know what this sort is called, if it even has a name. It's a
kind of Selection Sort, as each pass it looks for the minimum of the
remaining unsorted items. But it ruffles the unsorted list each pass,
seemingly to save using an extra register to store the current minumum
(there
1 - 100 of 1146 matches
Mail list logo