On Fri, 28 Oct 2011 01:36:41 +0200, candide wrote:
> Le 28/10/2011 00:57, Hrvoje Niksic a écrit :
>
>> was used at class definition time to suppress it. Built-in and
>> extension types can choose whether to implement __dict__.
>>
>>
> Is it possible in the CPython implementation to write somethi
On Thu, 27 Oct 2011 12:08:45 +0200, candide wrote:
> I realize that built-in types objects don't provide a __dict__ attribute
> and thereby i can't set an attribute to a such object, for instance
Note that possession or absence of a __dict__ attribute doesn't
necessarily mean that you can or can
On 10/27/2011 4:58 PM, Matej Cepl wrote:
Dne 27.10.2011 21:49, Terry Reedy napsal(a):
Use '_append', etc, much like namedtuple does, for the same reason.
Right, done. What about the presentation issue? Any ideas?
No.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 10/27/2011 3:38 PM, Lee Harr wrote:
I develop the free python-based turtle graphics application pynguin.
http://pynguin.googlecode.com/
Lately I have been getting a lot of positive comments from people
who use the program, but I am also getting a lot of feedback from
people on Windows (mos
On 10/28/2011 08:48 AM, DevPlayer wrote:
On Oct 27, 3:59 pm, Andy Dingley wrote:
I have some XML, with a variable and somewhat unknown structure. I'd
like to encapsulate this in a Python class and expose the text of the
elements within as properties.
How can I dynamically generate properties (
On Fri, Oct 28, 2011 at 2:05 PM, Fletcher Johnson wrote:
> If I create a new Unicode object u'\x82\xb1\x82\xea\x82\xcd' how does
> this creation process interpret the bytes in the byte string? Does it
> assume the string represents a utf-16 encoding, at utf-8 encoding,
> etc...?
>
> For reference
On Oct 27, 2011, at 11:05 PM, Fletcher Johnson wrote:
> If I create a new Unicode object u'\x82\xb1\x82\xea\x82\xcd' how does
> this creation process interpret the bytes in the byte string? Does it
> assume the string represents a utf-16 encoding, at utf-8 encoding,
> etc...?
>
> For reference th
On 10/27/2011 8:09 PM, Patrick Maupin wrote:
> x[:] = (x for x in xrange(32))
This translates to
s.__setitem__(slice(None,None), generator_object)
where 'generator_object' is completely opaque, except that it will yield
0 to infinity objects in response to next() before raising StopIteration.
If I create a new Unicode object u'\x82\xb1\x82\xea\x82\xcd' how does
this creation process interpret the bytes in the byte string? Does it
assume the string represents a utf-16 encoding, at utf-8 encoding,
etc...?
For reference the string is これは in the 'shift-jis' encoding.
--
http://mail.python
On Oct 27, 9:46 pm, candide wrote:
> Le 28/10/2011 02:02, MRAB a crit :
>
>
>
> > No, built-in classes written in C have certain limitations, but why
> > would you want to do that anyway?
>
> Mainly for learning purpose and Python better understanding.
>
> Actually, I have a class of mine for draw
On Oct 28, 8:52 am, candide wrote:
> No but I'm expecting from Python documentation to mention the laws of
> Python ...
It's not a "law", it's an _implementation detail_. The docs don't tend
to mention every such decision made because that's what the source is
for.
> But beside this, how to reco
Le 28/10/2011 02:02, MRAB a écrit :
No, built-in classes written in C have certain limitations, but why
would you want to do that anyway?
Mainly for learning purpose and Python better understanding.
Actually, I have a class of mine for drawing graphs with the Graphviz
software. The nodes
On 10/27/2011 6:52 PM, candide wrote:
No but I'm expecting from Python documentation to mention the laws of
Python ...
The details of CPython builtin classes are not laws of Python. It *is* a
'law of Python' that classes can use 'slots = ' to restrict the
attributes of instances. By implicat
On Thu, 27 Oct 2011 01:57:55 -0700, faucheuse wrote:
> I get this error : OSError : [Errno 8] Exec format error.
The most likely reason for this error is a missing or invalid
shebang, e.g.:
#!/usr/bin/python
or:
#!/usr/bin/env python
The "#!" must be the first two bytes in the f
The Natural Language Toolkit (NLTK) is a suite of open source Python
packages for natural language processing, available at
http://nltk.org/, together with an O'Reilly book which is available
online for free. Development is now hosted at http://github.com/nltk
-- get it here: g...@github.com:nltk/
Second error
def isvalid_named_reference( astring ):
# "varible name" is really a named_reference
import __builtin__# add line
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 27, 5:31 pm, Steven D'Aprano wrote:
> From the outside, you can't tell how big a generator expression is. It has no
> length:
I understand that.
> Since the array object has no way of telling whether the generator will have
> the correct size, it refuses to guess.
It doesn't have to gu
On 28/10/2011 00:36, candide wrote:
Le 28/10/2011 00:57, Hrvoje Niksic a écrit :
was used at class definition time to suppress it. Built-in and
extension types can choose whether to implement __dict__.
Is it possible in the CPython implementation to write something like this :
"foo".bar = 4
Le 28/10/2011 00:57, Hrvoje Niksic a écrit :
was used at class definition time to suppress it. Built-in and
extension types can choose whether to implement __dict__.
Is it possible in the CPython implementation to write something like this :
"foo".bar = 42
without raising an attribute erro
At least one error:
change:
> for astr in dir(__builtins__):
to:
for astr in __builtins__.__dict__:
--
http://mail.python.org/mailman/listinfo/python-list
Personally I like to use this function instead of a "try: except:"
because try-except will allow names like __metaclass__.
Remember, setattr(obj, attr_name, value) allows attr_name to be any
valid str().
For example: '!@kdafk11', or '1_1', '1e-20', '0.0', '*one', '\n%%',
etc.
def isvalid_named_re
candide writes:
> But beside this, how to recognise classes whose object doesn't have a
> __dict__ attribute ?
str, list and others aren't classes, they are types. While all
(new-style) classes are types, not all types are classes. It's
instances of classes (types created by executing the "cla
Le 28/10/2011 00:19, Steven D'Aprano a écrit :
What, you think it goes against the laws of physics that nobody thought
to mention it in the docs?
No but I'm expecting from Python documentation to mention the laws of
Python ...
But beside this, how to recognise classes whose object does
On Fri, Oct 28, 2011 at 1:36 AM, Duncan Booth
wrote:
> Try thinking that one through. Imagine you could set up a dictionary the
> way you describe
>
> A dict with itself as its own __dict__ becomes like a javascript object
> where subscripting and attribute access are mostly interchangeable.
Yeah
On Thu, 27 Oct 2011 13:34:28 -0700, Patrick Maupin wrote:
> Bug or misunderstanding?
>
> Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) [GCC 4.5.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
x = 32 * [0]
x[:] = (x for x in xrange(32))
from
On Thu, 27 Oct 2011 16:01:25 +0200, candide wrote:
> OK, thanks for the information abouts the slots. Nevertheless, this
> cannot answer completely my question. Some builtin types like string,
> lists, integer, float, dictionaries, etc have the property that
> instances of those types don't provid
On Oct 27, 3:59 pm, Andy Dingley wrote:
> I have some XML, with a variable and somewhat unknown structure. I'd
> like to encapsulate this in a Python class and expose the text of the
> elements within as properties.
>
> How can I dynamically generate properties (or methods) and add them to
> my cl
Dne 27.10.2011 21:49, Terry Reedy napsal(a):
Use '_append', etc, much like namedtuple does, for the same reason.
Right, done. What about the presentation issue? Any ideas?
Best,
Matěj
--
http://mail.python.org/mailman/listinfo/python-list
Bug or misunderstanding?
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 32 * [0]
>>> x[:] = (x for x in xrange(32))
>>> from ctypes import c_uint
>>> x = (32 * c_uint)()
>>> x[:] = xrange(32)
>>
In Andy
Dingley writes:
> How can I dynamically generate properties (or methods) and add them to
> my class? I can easily produce a dictionary of the required element
> names and their text values, but how do I create new properties at run
> time?
You can set dynamic attributes on class objec
I have some XML, with a variable and somewhat unknown structure. I'd
like to encapsulate this in a Python class and expose the text of the
elements within as properties.
How can I dynamically generate properties (or methods) and add them to
my class? I can easily produce a dictionary of the requi
On 10/27/2011 6:36 AM, Tim Golden wrote:
On 27/10/2011 11:27, Propad wrote:
the suggestion to add the optional second parameter fixed the problem,
spawnl now works on the Win 7 computer I'm responsible for (with
Python 2.2). So the suggested cause seems to be right.
FWIW, although it's not obv
On 10/27/2011 4:50 AM, mcepl wrote:
Hi,
I have here a simple script (https://gitorious.org/json_diff/mainline)
which makes a diff between two JSON files. So for JSON objects
{
"a": 1,
"b": 2,
"son": {
"name": "Janošek"
}
}
and
{
"a": 2,
"c": 3,
"dau
On 10/27/2011 2:38 PM, Lee Harr wrote:
> I am hoping someone can look at what is there and come up with a
> reliable method or a simple set of steps that people can follow to get
> up and running. Hopefully without having to resort to the command
> prompt.
>
> I started a wiki page here:
> http://
I develop the free python-based turtle graphics application pynguin.
http://pynguin.googlecode.com/
Lately I have been getting a lot of positive comments from people
who use the program, but I am also getting a lot of feedback from
people on Windows (mostly beginners) who are having trouble
get
Well, please check the byte code compiled results. This is useful. I know that
a lot people are working on increasing the speed of execution scripts written
in python, say, psyco, pyrex for packages released!
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 27, 6:09 am, Gelonida N wrote:
> Hi,
>
> I have a rather 'simple' problem.
> Logging from multiple processes to the same file AND be sure, that no
> log message is lost,
>
> 1.) Log multiple processes to one file:
> --
>
> I have a python program, whi
I need to talk to an xmlrpc server. I open one connection and then
create a pile of threads communicating to that server. Based on some
limited testing, it seems to work really well. The next step is to
turn it into a pool. But before I continue, the question is: Does
anyone know if the xmlrpcl
On Oct 27, 11:09 am, Gelonida N wrote:
> "The following section documents this approach in more detail and
> includes a working socket receiver which can be used as a starting point
> for you to adapt in your own applications."
>
> Somehow I have a mental block though and fail to see the 'followin
> But beside this, how to recognise classes whose object doesn't have a
> __dict__ attribute ?
>
Why do you need to access __dict__ ? maybe dir is enough see the other
message
--
http://mail.python.org/mailman/listinfo/python-list
2011/10/27 candide
> I realize that built-in types objects don't provide a __dict__ attribute
> and thereby i can't set an attribute to a such object, for instance
>
>
> >>> a=[42,421]
> >>> a.foo="bar"
> Traceback (most recent call last):
> File "", line 1, in
> AttributeError: 'list' object h
On Oct 27, 1:11 am, Andreas Neudecker wrote:
> Any more philsophical Python code out there?
That is the question.
--
http://mail.python.org/mailman/listinfo/python-list
2011/10/27 Chris Rebert
> On Wed, Oct 26, 2011 at 2:14 AM, Amirouche Boubekki
> wrote:
> > Héllo,
> >
> > I would like to fork simplejson [1] and implement serialization rules
> based
> > on protocols instead of types [2], plus special cases for protocol free
> > objects, that breaks compatibili
Chris Angelico wrote:
> On Thu, Oct 27, 2011 at 10:03 PM, Duncan Booth
> wrote:
>> Types without a __dict__ use less memory. Also, if you couldn't have a
>> type that didn't have a `__dict__` then any `dict` would also need its
>> own `__dict__` which would either result in infinite memory use or
On Oct 26, 2:47 pm, Dave Angel wrote:
> On 10/26/2011 03:48 PM, Ross Boylan wrote:
>
>
>
>
>
>
>
> > I want to replace every \ and " (the two characters for backslash and
> > double quotes) with a \ and the same character, i.e.,
> > \ -> \\
> > " -> \"
>
> > I have not been able to figure out ho
On Wed, Oct 26, 2011 at 2:14 AM, Amirouche Boubekki
wrote:
> Héllo,
>
> I would like to fork simplejson [1] and implement serialization rules based
> on protocols instead of types [2], plus special cases for protocol free
> objects, that breaks compatibility. The benefit will be a better API for
>
On Thu, Oct 27, 2011 at 6:55 AM, Amirouche Boubekki
wrote:
>
>>> +---+---+
>>> | Python protocol | JSON |
>>> | or special case | |
>>> +===+===+
>>> | (ø) __json__ | see (ø) |
>>> +---+---|
>>> | map
Le 27/10/2011 13:03, Duncan Booth a écrit :
-- where the official documentation refers to this point ?
See http://docs.python.org/reference/datamodel.html for the docs about
__slots__
There is also the API documentation which describes at a low level how
to control whether or not instances
Hi,
I have released pyKook 0.6.0.
http://pypi.python.org/pypi/Kook/0.6.0
http://www.kuwata-lab.com/kook/
http://www.kuwata-lab.com/kook/pykook-users-guide.html
In this release, a lot of enhancements are introduced.
pyKook Overview
---
pyKook is a task automation tool for Python, si
> +---+---+
>> | Python protocol | JSON |
>> | or special case | |
>> +===+=**==+
>> | (ø) __json__ | see (ø) |
>> +---+-**--|
>> | map | object|
>>
>
> I am curious what you mean by the '
On Thu, Oct 27, 2011 at 10:03 PM, Duncan Booth
wrote:
> Types without a __dict__ use less memory. Also, if you couldn't have a
> type that didn't have a `__dict__` then any `dict` would also need its
> own `__dict__` which would either result in infinite memory use or
> recursive dictionaries.
>
Am 26.10.2011 19:34, schrieb Nathan Rice:
Since this happily went off to the wrong recipient the first time...
The python json module/simpljson are badly in need of an architecture
update. The fact that you can't override the encode method of
JSONEncoder and have it work reliably without monkey
candide wrote:
> I realize that built-in types objects don't provide a __dict__
attribute
> and thereby i can't set an attribute to a such object, for instance
>
>
> >>> a=[42,421]
> >>> a.foo="bar"
> Traceback (most recent call last):
>File "", line 1, in
> AttributeError: 'list' object
On 27 October 2011 11:08, candide wrote:
> I realize that built-in types objects don't provide a __dict__ attribute and
> thereby i can't set an attribute to a such object, for instance
>
>
a=[42,421]
a.foo="bar"
> Traceback (most recent call last):
> File "", line 1, in
> AttributeErr
On Oct 27, 11:27 am, Hans Mulder wrote:
> On 27/10/11 10:57:55, faucheuse wrote:
>
> > I'm trying to launch my python program with another process name than
> > "python.exe".
>
> Which version of Python are you using?
> Which version of which operating system?
>
> > In order to do that I'm trying
On 27/10/2011 11:27, Propad wrote:
the suggestion to add the optional second parameter fixed the problem,
spawnl now works on the Win 7 computer I'm responsible for (with
Python 2.2). So the suggested cause seems to be right.
FWIW, although it's not obvious, the args parameter to spawnl
is inte
Hello Gentelmen,
the suggestion to add the optional second parameter fixed the problem,
spawnl now works on the Win 7 computer I'm responsible for (with
Python 2.2). So the suggested cause seems to be right.
Thank you for the great help!
Cheers,
Nenad
On 26 Okt., 21:20, Terry Reedy wrote:
>
I realize that built-in types objects don't provide a __dict__ attribute
and thereby i can't set an attribute to a such object, for instance
>>> a=[42,421]
>>> a.foo="bar"
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'list' object has no attribute 'foo'
>>> a.__dict
Hi,
I have a rather 'simple' problem.
Logging from multiple processes to the same file AND be sure, that no
log message is lost,
1.) Log multiple processes to one file:
--
I have a python program, which I want to log, but which forks several times.
Due
On 27/10/11 10:57:55, faucheuse wrote:
I'm trying to launch my python program with another process name than
"python.exe".
Which version of Python are you using?
Which version of which operating system?
In order to do that I'm trying to use the os.execvp function :
os.execvp("./Launch.py", [
On 27 říj, 10:50, mcepl wrote:
> Hi,
>
> I have here a simple script (https://gitorious.org/json_diff/mainline)
> which makes a diff between two JSON files. So for JSON objects
and I have completely burried to lead on this. The point is that the
resulting object can be endlessly recursively neste
Hi,
I have here a simple script (https://gitorious.org/json_diff/mainline)
which makes a diff between two JSON files. So for JSON objects
{
"a": 1,
"b": 2,
"son": {
"name": "Janošek"
}
}
and
{
"a": 2,
"c": 3,
"daughter": {
"name": "Maruška"
}
}
i
Hi,
I'm trying to launch my python program with another process name than
"python.exe".
In order to do that I'm trying to use the os.execvp function :
os.execvp("./Launch.py", ["ProcessName"])
Launch.py is the file that Launch the program and ProcessName is
the ... Process Name ^^
I get this er
http://blog.stuttgarter-zeitung.de/fundstucke/2011/10/27/genehmigt-vom-ministerium-fur-alberne-gangarten/
--
http://mail.python.org/mailman/listinfo/python-list
Not the answers I expected:
;-)
>>> b = True
>>> 2*b or not 2*b
2
>>> b = False
>>> 2*b or not 2*b
True
It all becomes clear when you look at:
>>> b = False
>>> 2*b
0
>>> b = True
>>> 2*b
2
No surprise there really. But fun anyway.
Any more philsophical Python code out there?
--
http://ma
65 matches
Mail list logo