ANN: cssutils 0.9.6b5 (bugfix release)

2009-08-30 Thread Christof Hoeke

what is it
--
A Python package to parse and build CSS Cascading Style Sheets. (Not a 
renderer though!)


about this release
--
0.9.6b5 is a bugfix release.

main changes

+ BUGFIX: Issue #30 fixed. Setup from source did not work.

license
---
cssutils is published under the LGPL version 3 or later, see 
http://cthedot.de/cssutils/


If you have other licensing needs please let me know.

download

For download options see http://cthedot.de/cssutils/

cssutils needs Python 2.4 or higher (tested with Python 2.6.2, 2.5.2, 
2.4.4 and Jython 2.5 on Vista only)



Bug reports (via Google code), comments, etc are very much appreciated! 
Thanks.


Christof
--
http://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


Re: An assessment of the Unicode standard

2009-08-30 Thread Neil Hodgson
Chris Jones:

 Is the implication that the principal usefulness of such languages as
 Hindi and other Indian languages is us selling things to them..? 

   Unicode was developed by a group of US corporations: Xerox, Apple,
Sun, Microsoft, ... The main motivation was to avoid dealing with
multiple character set encodings since this was difficult, time
consuming and expensive.

 I
 am not from these climes but all the same, I do find you tone of voice
 rather offensive, considering that you are referring to a culture that's
 about 3000 years older and 3000 richer than ours and certainly deserves
 our respect.

   Eh? Was Unicode developed in India? China? What precisely is
direspectful here? Is there a significant population that regards
Unicode as their 'holy patrimony' that will suffer distress due to my
post?

 Maybe you didn't notice, but our plants shut down many years ago.. They
 are selling _us_ their wares.

   Maybe your plants shut down but some of the plants I have worked at
(such as the steelworks at Port Kembla) are still successfully exporting
to Asia.

   Neil
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: break unichr instead of fix ord?

2009-08-30 Thread Martin v. Löwis
 To reiterate, I am not advocating for any change.  I
 simply want to understand if there is a good reason
 for limiting the use of unchr/ord on narrow builds to
 a subset of the unicode characters that Python otherwise
 supports.  So far, it seems not and that unichr/ord
 is a poster child for purity beats practicality.

I think that's actually the case. I went back to the discussions,
and found that early 2.2 alpha releases did return two-byte
strings from unichr, and that this was changed because Marc-Andre
Lemburg insisted. Here are a few relevant messages from the
archives (search for unichr)

http://mail.python.org/pipermail/python-dev/2001-June/015649.html
http://mail.python.org/pipermail/python-dev/2001-July/015662.html
http://mail.python.org/pipermail/python-dev/2001-July/016110.html
http://mail.python.org/pipermail/python-dev/2001-July/016153.html
http://mail.python.org/pipermail/python-dev/2001-July/016155.html
http://mail.python.org/pipermail/python-dev/2001-July/016186.html

Eventually, in r28142, MAL changed it to give it its current
state.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread Steven D'Aprano
On Sun, 30 Aug 2009 00:22:00 -0400, Chris Jones wrote:

 On Sat, Aug 29, 2009 at 11:07:17PM EDT, Neil Hodgson wrote:
 Benjamin Peterson:
 
  Like Sanskrit or Snowman language?
 
 Sanskrit is mostly written in Devanagari these days which is also
 useful for selling things to people who speak Hindi and other Indian
 languages.
 
 Is the implication that the principal usefulness of such languages as
 Hindi and other Indian languages is us selling things to them..? I
 am not from these climes but all the same, I do find you tone of voice
 rather offensive, 

I think Neil's point is that Unicode has succeeded in the wider world, 
outside of academic circles, because of the commercial need to 
communicate between cultures using different character sets. I suppose he 
could have worded it better, but fundamentally he's right: without the 
commercial need to trade across the world (information as well as 
physical goods) I doubt Unicode would be anything more than an 
interesting curiosity of use only to a few academics and linguists.


 considering that you are referring to a culture that's
 about 3000 years older and 3000 richer than ours and certainly deserves
 our respect.

Older, certainly, but richer? There's a reason that Indians come to the 
West rather than Westerners going to India. As Terry Pratchet has 
written, age is not linked to wisdom -- just because somebody is old, 
doesn't mean they're wise, perhaps they've just been stupid for a very 
long time. The same goes for cultures: old doesn't mean better.

Indian culture has been responsible for many wonderful things over the 
millennia, but the cast system is not one of them, and any culture which 
glorified sati (suttee) as an act of piety is not one we should look up 
to. Sati was probably rare even at the height of it's popularity, and 
vanishingly rare now, and arguably could even be defended as the right of 
an adult to end their own life when they see fit, but dowry-burning is 
outright murder and is sadly very common across the Indian sub-continent: 
some estimates suggest that in the mid-1990s there were nearly 6000 such 
murders a year in India.

If we are to be truly non-racist, we must recognise that the West does 
not have a monopoly on wickedness, ignorance, spite and sheer awfulness.  

In any case, I'm not sure we should be talking about Indian culture in 
the singular -- India is about as large as Western Europe, significantly 
more varied, and the culture has changed over time. The India which 
treated the Karma Sutra as a holy book is hardly the same India where 
people literally rioted in the street because Richard Gere gave the 
actress Shilpa Shetty a couple of rather theatrical and silly kisses on 
the cheek.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Object's nesting scope

2009-08-30 Thread zaur
On 30 авг, 03:22, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
 En Sat, 29 Aug 2009 04:34:48 -0300, zaur szp...@gmail.com escribió:



  On 29 авг, 08:37, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
  En Fri, 28 Aug 2009 15:25:55 -0300, zaur szp...@gmail.com escribió:
   On 28 авг, 16:07, Bruno Desthuilliers bruno.
   42.desthuilli...@websiteburo.invalid wrote:
   zaur a écrit :

Ok. Here is a use case: object initialization.

   Err... Looks like you really should read the FineManual(tm) -
   specifically, the parts on the __init__ method.

   What are you doing if 1) classes Person and Address imported from
   foreign module 2) __init__ method is not defined as you want?

  Welcome to dynamic languages! It doesn't matter *where* the class was  
  defined. You may add new attributes to the instance (even methods to  
  the class) at any time. [...4 examples...]

  I know about these ways of object initializing. What I said is about
  using object's dictionary as nested scope in code block. Object
  initialization is just one use case.
  So we say about different things.

 Well, you asked how to proceed in certain cases and I showed several ways  
 it can be done right now, without requiring a new scope. You'll have to  
 think of another use case.

 Attribute lookup is explicit in Python, and that's a very good thing. If  
 you follow the python-ideas thread posted earlier, you'll see the kind of  
 problems an implicit attribute lookup would cause. The with statement is  
 necesary (and a good thing) in Pascal, but not in Python.

 Zope2 departs from this explicitness: it has a dtml-with construct  
 (similar to what you propose), and I hate it profoundly every time I have  
 to edit a DTML file - I can never tell *where* an attribute comes from.  
 Another related feature is acquisition, a stack of namespaces where  
 objects inherit attributes from their containers. Same thing, a complete  
 waste of time every time I have to track a bug.

 Unless you can find a very compeling use case, I don't think this feature  
 will become part of the language anytime soon...

 --
 Gabriel Genellina


The same can be said about multiple inheritance.
However, multiple inheritance is a powerful tool in the hands of
someone who can properly and effectively use it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sat, Aug 29, 2009 at 07:03:23PM +, Steven D'Aprano wrote:
 On Sat, 29 Aug 2009 11:11:43 -0700, zaur wrote:
 
  I thought that int as object will stay the same object after += but with
  another integer value. My intuition said me that int object which
  represent integer value should behave this way.
 
 If it did, then you would have this behaviour:

No, you wouldn't; the behavior you described is completely different
from, and incompatible with, what zaur wrote.  

He's saying that instead of thinking the integer value of 3 itself
being the object, he expected Python's object model would behave as
though the entity m is the object, and that object exists to contain
an integer value.  In that case, m is always m, but it has whatever
integer value it is told to hold at any point in time.  The
self-referential addition would access the value of m, add the
operand, and store the result back in the same object as the object's
value.  This is not the way Python works, but he's saying this is the
intuitive behavior.  I happen to agree, and argued at length with you
and others about that very thing months ago, when some other third
party posted with that exact same confusion.  

By contrast, your description maintains the concept of numerical value
as object that Python uses, and completely misses the point.  I did
find the description you gave to be highly enlightening though...  It
highlighted perfectly, I think, exactly why it is that Python's behavior
regarding numerical values as objects is *not* intuitive.  Of course,
intuition is highly subjective.

I believe it boils down to this:  People expect that objects they
create are mutable.  At least, unless they specify otherwise.  It is
so in some other programming languages which people may be likely to
be familiar with (if they are not taking their first forray into the
world of computing by learning Python), and even real world objects
are essentially always mutable.  If you have a 2002 Buick LeSabre, it
has a number of attributes, including its length, which might be 8.5
feet, for instance.  However, this is not fixed: by adding modified
body parts, or as an extreme example by sawing off the trunk of the
car, the length and indeed the object itself has been changed.
However, despite having been modified, it is at least in some sense
still the same object: it is still a 2002 Buick LeSabre, and it still
has the same *identity* (the same VIN number).  It's the same object,
but its value(s) changed.  [Not that it matters, but I do not own such
a car. :)]

Numbers are fundamentally different from objects.  The number 3 is a
symbol of the idea of the existence of three countable objects.  It
can not be changed (though it can be renamed, if you so choose -- just
don't expect most people to know what you're talking about).  It is
unintuitive that 3 is an object; it is rather what we use to describe
objects -- the value of the object.  It is an abstract concept, and
as such it is not an object at all.  You cannot hear 3, taste
3, nor smell 3.  You can neither see nor touch 3, though you can
certainly see 3 *objects* if they are present, and you can certainly
see the symbol '3' that we use to represent that idea... but you can
not see three itself, because there is no such object.  The only way
to see three is to envision 3 of some object.  The number 3 does not
have a value; it IS a value (it is the symbolic representation of the
value of three).  To say that 3 is an object that has a value is a bit
like saying the length of a car is an object that itself has a length.
It just doesn't compute.

THAT is why Python's behavior with regard to numerical objects is
not intuitive, and frankly bizzare to me, and I dare say to others who
find it so.

Yes, that's right.  BIZZARE.

Of course, none of this is real.  In the end, it's all just a bunch of
wires that either have current or don't.  It's only how *WE* organize
and think about that current that gives it any meaning.  So you're
free to think about it any way you like.

-- 
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D



pgpyymVqHadto.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IDE for python similar to visual basic

2009-08-30 Thread Detlev Offenbach
qwe rty wrote:

 i have been searching for am IDE for python that is similar to Visual
 Basic but had no luck.shall you help me please?

eric4 should be a good candidate.

http://eric-ide.python-projects.org

Detlev
-- 
Detlev Offenbach
det...@die-offenbachs.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Overriding iadd for dictionary like objects

2009-08-30 Thread RunThePun
On Aug 29, 1:58 pm, Carl Banks pavlovevide...@gmail.com wrote:
 On Aug 28, 10:37 pm, Joshua Judson Rosen roz...@geekspace.com wrote:





  Carl Banks pavlovevide...@gmail.com writes:

   On Aug 28, 2:42 pm, Terry Reedy tjre...@udel.edu wrote:

Carl Banks wrote:
 I don't think it needs a syntax for that, but I'm not so sure a method
 to modify a value in place with a single key lookup wouldn't
 occasioanally be useful.

Augmented assignment does that.

   Internally uses two lookups, one for getting, and one for setting.

   I think this is an unavoidable given Python's semantics.  Look at
   the traceback:

def x():
   ...     d['a'] += 1
   ...
dis.dis(x)
     2           0 LOAD_GLOBAL              0 (d)
                 3 LOAD_CONST               1 ('a')
                 6 DUP_TOPX                 2
                 9 BINARY_SUBSCR

  OK, there's one lookup, but...

                10 LOAD_CONST               2 (1)
                13 INPLACE_ADD
                14 ROT_THREE
                15 STORE_SUBSCR
                16 LOAD_CONST               0 (None)
                19 RETURN_VALUE

  ... I don't see anything in there that retrieves the value a second time

 STORE_SUBSCR has to look up the position in the hash table to store
 the value, hence the second lookup.

 As a workaround, if lookups are expensive,

But they are not. Because (C)Python is heavily based on dict name lookup
for builtins and global names and attributes, as well as overt dict
lookup, must effort has gone into optimizing dict lookup.

   The actual lookup algorithm Python dicts use is well-optimized, yes,
   but the dict could contain keys that have expensive comparison and
   hash-code calculation, in which case lookup is going to be slow.

  I'll like the originator correct me if I've made a mistake, but I read
  lookup as actually meaning lookup, not value-comparison.

 This has nothing to do with value comparison.  I was talking about key
 comparison, which happens when looking up a position in a hash table.
 I was the first person to use the word lookup in this thread and I
 specifically meant hash-table position lookup.

  At least in part because the question, as it was posed, specifically
  related to a wrapper-class (providing a mapping (dict like) interface)
  around a database of some sort other than Python's dict class per se.

  How do the details of Python's native dict-type's internal (hashtable)
  algorithm matter when they're explicitly /not/ being used?

 Well it doesn't apply specifically to the OP's problem.  I changed the
 topic a bit by making it specific to dicts.  Is that ok with you?  Was
 that not allowed?

 The OP can add a method like apply_to_value to his own class, but one
 can't do that for dicts.  Ergo why something like apply_to_value()
 would be useful enough in rare circumstances where lookup is very slow
 to merit a moments consideration before being rejected.

 (If dict did have a method like that, the OP would at least know which
 method to override.)

 Carl Banks

First of all I'd like to say thanks for this discussion, you guys are
awesome.

I probably should have explained my problem better to begin with and I
apologize for that. So now I'll start from the top:

I made a DictMixin where the keys are filenames and the values are the
file contents. It was very simple and easy to do thanks to DictMixin.

For example this code writes abc in a file named temp.txt and
prints the contents of the file named swallow, these files are
looked up/created/deleted in the directory spam:
 d = FilesDict('spam')
 d['temp.txt'] = 'abc'
 print(d['swallow'])

This was very convenient for me because I wanted to use a simple DB
which could be read and edited by shell scripts and non-pythonistas,
without the heavy ORM. Also, if in the future an online full featured
DB would be needed, I could easily convert the DictMixin methods.  So
up to here I had a good solution.

My problem arose when I wanted to append a string to a file which
using open(..., 'ab') would have been miles more efficient because I
wouldn't have to read the entire file (__getitem__) and then write the
entire file back (__setitem__). The files are expected to be as big as
600 KB which will be appended 30 bytes at a time about 3 times a
second. Performance-wise the system would probably work without open
(..., 'ab') but it would be a real thrashing so the current solution
uses a method AddTo as Robert suggested, sacrificing the neat
getitem/setitem syntax.

Just so I don't leave out any information, I actually also made a
DirectoryDict for having multiple 'tables'. In this DictMixin, keys
are directory names and values are FilesDict instances. So to write
European or African to the file /root/tmp/velocity one would be
just:
 d = DirectoryDict(/root)
 d[tmp][velocity] = European or African

So now I hope it's clearer why and how I wanted a special
__item_iadd__ for the dictionary syntax,

RunThePun

Re: Is behavior of += intentional for int?

2009-08-30 Thread Mark Dickinson
On Aug 29, 8:03 pm, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
 On Sat, 29 Aug 2009 11:11:43 -0700, zaur wrote:
  I thought that int as object will stay the same object after += but with
  another integer value. My intuition said me that int object which
  represent integer value should behave this way.

 If it did, then you would have this behaviour:

  n = 3                     # bind the name n to the object 3
  saved_id = id(n)          # get the id of the object
  n += 1                    # add one to the object 3
  assert n == 4             # confirm that it has value four
  assert id(n) == saved_id  # confirm that it is the same object
  m = 3                     # bind the name m to the object 3
  print m + 1               # but object 3 has been modified

 5

I don't see how that follows.  In an alternative interpretation, the
int literals would all be thought of as distinct objects:  that is,
the line 'n = 3' creates an integer object with value 3 and binds the
name n to it;  the later line 'm = 3' then creates another *new*
integer object with value 3 and binds the name m to it.  In other
words, it could work in exactly the same way as the following works in
Python:

 n = {}
 n[1729] = 10585
 m = {}
 m
{}

The modification to n doesn't affect m, since the two occurrences of
{} give distinct dictionary objects.

--
Mark
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread garabik-news-2005-05
r rt8...@gmail.com wrote:
 
 Some may say well how can we possibly force countries/people to speak/
 code in a uniform manner? Well that's simple, you just stop supporting
 their cryptic languages by dumping Unicode and returning to the
 beautiful ASCII and adopting English as the universal world language.
v Why English? Well because it is so widely spoken. But whatever we
 choose just choose one language and stick with it, perfect it, and
 maintain it.
 

Y’know, it is naïve to think that the “beautiful” ASCII is
sufficient for English…

Besides, there is the APL... (though, you are right, we should dump
those crappy old languages and use Python exclusively)

-- 
 ---
| Radovan Garabík http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__garabik @ kassiopeia.juls.savba.sk |
 ---
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!
-- 
http://mail.python.org/mailman/listinfo/python-list


How i follow tree folders from url

2009-08-30 Thread catalinf...@gmail.com
Hello !

I wanna use python to follow the tree folders from one url.
Example :
If url is www.site.com/first/ and 
first is first folder with next subfolders 01,02,03
The result of script should be :

www.site.com/first/01/
www.site.com/first/02/
www.site.com/first/03/
Maybe urllib has some functions , but i don't know them.

Please help me !
Thank you !
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread Thorsten Kampe
* r (Sat, 29 Aug 2009 18:30:34 -0700 (PDT))
 We don't support a Python group in Chinese or French, so why this?

We do - you don't (or to be more realistic, you simply didn't know 
it).

 Makes no sense to me really.

Like probably 99.9% of all things you hear, read, see and encounter 
during the day.

By the way: the dumbness of your Unicode rant would have even ashamed 
the great XL himself.

Thorsten
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How i follow tree folders from url

2009-08-30 Thread Chris Rebert
On Sun, Aug 30, 2009 at 1:20 AM,
catalinf...@gmail.comcatalinf...@gmail.com wrote:
 Hello !

 I wanna use python to follow the tree folders from one url.
 Example :
 If url is www.site.com/first/ and 
 first is first folder with next subfolders 01,02,03
 The result of script should be :

 www.site.com/first/01/
 www.site.com/first/02/
 www.site.com/first/03/
 Maybe urllib has some functions , but i don't know them.

HTTP has no equivalent to ls. You have to either know the format the
of URLs yourself or spider the links on a given page.
To generate the URLs if you know the scheme, use range() and str.zfill().

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread Thorsten Kampe
* Neil Hodgson (Sun, 30 Aug 2009 06:17:14 GMT)
 Chris Jones:
 
  I am not from these climes but all the same, I do find you tone of
  voice rather offensive, considering that you are referring to a
  culture that's about 3000 years older and 3000 richer than ours and
  certainly deserves our respect.
 
 Eh? Was Unicode developed in India? China?

Chris was obviously talking about Sanskrit...

Thorsten
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread Thorsten Kampe
* Chris Jones (Sun, 30 Aug 2009 00:22:00 -0400)
 On Sat, Aug 29, 2009 at 11:07:17PM EDT, Neil Hodgson wrote:
  Sanskrit is mostly written in Devanagari these days which is also
  useful for selling things to people who speak Hindi and other Indian
  languages.
 
 Is the implication that the principal usefulness of such languages as
 Hindi and other Indian languages is us selling things to them..? I
 am not from these climes but all the same, I do find you tone of voice
 rather offensive, considering that you are referring to a culture that's
 about 3000 years older and 3000 richer than ours and certainly deserves
 our respect.

Neil was obviously talking about Devanagari. Please also mind the 
principal difference between Neil's also useful and your principal 
useful(ness).

Thorsten
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread Antoine Pitrou
r rt8396 at gmail.com writes:
 
 Why should the larger world
 keep supporting such antiquated languages and character sets through
 Unicode? What purpose does this serve? Are we merely trying to make
 everyone happy? A sort of Utopian free-language-love-fest-kinda-
 thing?

Can you go and troll somewhere else?

Thanks.

Antoine.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread Thorsten Kampe
* John Machin (Sat, 29 Aug 2009 17:20:47 -0700 (PDT))
 On Aug 30, 8:46 am, r rt8...@gmail.com wrote:
 
  Take for instance the Chinese language with it's thousands of
  characters and BS, it's more of an art than a language.  Why do we
  need such complicated languages in this day and time. Many languages
  have been perfected, (although not perfect) far beyond that of
  Chinese language.
 
 The Chinese language is more widely spoken than English, is quite
 capable of expression in ASCII (r tongzhi shi sha gua) and doesn't
 have those pesky it's/its problems.

You could also put it differently: the Chinese language (like any other 
language) doesn't even have characters. It's really funny to see how 
someone who rants about Unicode doesn't event knows the most basic 
facts.

Thorsten
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: weak reference callback

2009-08-30 Thread larudwer

Paul Pogonyshev pogonys...@gmx.net schrieb im Newsbeitrag 
news:mailman.658.1251577954.2854.python-l...@python.org...
 Hi,

 Is weak reference callback called immediately after the referenced
 object is deleted or at arbitrary point in time after that?  I.e. is
 it possible to see a dead reference before the callback is called?

 More formally, will this ever raise?

callback_called = False
def note_deletion (ref):
callback_called = True
ref = weakref.ref (x, note_deletion)
if ref () is None and not callback_called:
raise RuntimeError (reference is dead, yet callback hasn't been 
 called yet)

The Manual says:
If callback is provided and not None, and the returned weakref object is 
still alive, the callback will be called when the object is about to be 
finalized; the weak reference object will be passed as the only parameter to 
the callback; the referent will no longer be available.

This says that the Object is deleted first, and the callback functions will 
be called after that. Since after 'after that'  IS an arbitrary point in 
time your example SHOULD raise.

I think it is save to assume that this will never raise in an single 
threaded cpython application because the GIL and reference counting scheme 
etc. will prevent this.

However, this is an implementation specific detail of the cpython runtime 
and it is not save to rely on this behavior.
It may be completely different in an multi threaded environment or any other 
implementation of Python.









-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Steven D'Aprano
On Sun, 30 Aug 2009 02:33:05 -0500, Derek Martin wrote:

 On Sat, Aug 29, 2009 at 07:03:23PM +, Steven D'Aprano wrote:
 On Sat, 29 Aug 2009 11:11:43 -0700, zaur wrote:
 
  I thought that int as object will stay the same object after += but
  with another integer value. My intuition said me that int object
  which represent integer value should behave this way.
 
 If it did, then you would have this behaviour:
 
 No, you wouldn't; the behavior you described is completely different
 from, and incompatible with, what zaur wrote.
 
 He's saying that instead of thinking the integer value of 3 itself being
 the object, he expected Python's object model would behave as though the
 entity m is the object, and that object exists to contain an integer
 value.

What is the entity m?

Is it the name m, as follows?

 m = 3  # bind the object 3 to the name m

Or is it the literal 3 (without quotes)?

Or an object holding the value three?

Or something else?


 In that case, m is always m, 
 but it has whatever integer value
 it is told to hold at any point in time.  The self-referential addition
 would access the value of m, add the operand, and store the result back
 in the same object as the object's value.

Ah wait, I think I get it... is m a memory location? So when you say:

m = 3

the memory location that m represents is set to the value 3, and when you 
say:

m += 1

the memory location that m represents is set to the value 4?

That would be how Pascal and C (and presumably other languages) work, but 
not Python or Ruby or even VB (so I'm told) and similar languages. Java 
has a hybrid model, where a few data types (such as ints) are handled 
like C, and everything else is handled like Python. Consistency was never 
Java's strong suit.


 This is not the way Python
 works, but he's saying this is the intuitive behavior.

It isn't intuitive if you've never been exposed to Pascal- or C-like 
languages. If your only programming language was Haskell, the very idea 
of mutating values would be alien. So I guess when you say the intuitive 
behaviour, what you actually mean is familiar.


 I happen to
 agree, and argued at length with you and others about that very thing
 months ago, when some other third party posted with that exact same
 confusion.
 
 By contrast, your description maintains the concept of numerical value
 as object that Python uses, and completely misses the point.  I did find
 the description you gave to be highly enlightening though...  It
 highlighted perfectly, I think, exactly why it is that Python's behavior
 regarding numerical values as objects is *not* intuitive.  Of course,
 intuition is highly subjective.

What exactly is it about Python's behaviour regarding numbers that is not 
intuitive? That you can't do this?

 anum = 2
 alist = [anum]
 anum += 1
 print alist  # this doesn't work
[3]

That won't work in any language that I know of -- as far as I am aware, 
the above is impossible in just about every common programming language. 
(My C and VB are nearly non-existent, so I may be wrong about them.) Here 
is Ruby's behaviour:

irb(main):001:0 anum = 2
= 2
irb(main):002:0 alist = [anum]
= [2]
irb(main):003:0 anum += 1
= 3
irb(main):004:0 puts alist
2
= nil


Just like Python.


 I believe it boils down to this:  People expect that objects they create
 are mutable.

Why would they expect that? Is there any evidence apart from the 
anecdotal complaints of a few people that they expect this? People 
complain equally when they use a mutable default value and it mutates, or 
that they can't use mutable objects as dict keys, so this suggests that 
people expect objects should be immutable and are surprised when they 
change.

If you're going to argue by analogy with the real world (as you do 
further on), I think it's fair to argue that some objects are mutable 
(pieces of rubber that expand into a balloon when you blow into them), 
and some are immutable unless you expend extraordinary effort (rocks). I 
would be gobsmacked if my desk turned pink or changed into an armchair, I 
expect it to be essentially unchanging and immutable. But I fully expect 
a banana to turn black, then squishy, and finally white and fuzzy if I 
leave it long enough.


 At least, unless they specify otherwise.  It is so in some
 other programming languages which people may be likely to be familiar
 with (if they are not taking their first forray into the world of
 computing by learning Python), and even real world objects are
 essentially always mutable.
[snip example of a 2002 Buick LeSabre]

Be careful bringing real-world examples into this. People have been 
arguing about identity in the real-world for millennia. See, for example, 
the paradox of my great-grandfather's axe. My great-grandfather's axe is 
still in my family after 80 years, as good as new, although the handle 
has been replaced four times and the head twice. But it's still the same 
axe. An even older example is the paradox of the Ship of 

Re: Is behavior of += intentional for int?

2009-08-30 Thread Paul McGuire
On Aug 30, 2:33 am, Derek Martin c...@pizzashack.org wrote:
 THAT is why Python's behavior with regard to numerical objects is
 not intuitive, and frankly bizzare to me, and I dare say to others who
 find it so.

 Yes, that's right.  BIZZARE.


Can't we all just get along?

I think the question boils down to where is the object?.  In this
statement:

a = 3

which is the object, a or 3?

There exist languages (such as C++) that allow you to override the '='
assignment as a class operator.  So that I could create a class where
I decided that assigning an integer value to it applies some
application logic, probably the setting of some fundamental
attribute.  In that language, 'a' is the object, and 3 is a value
being assigned to it.  This can cause some consternation when a reader
(or worse, maintainer) isn't familiar with my code, sees this simple
assignment, and figures that they can use 'a' elsewhere as a simple
integer, with some surprising or disturbing results.

Python just doesn't work that way.

Python binds values to names. Always. In Python, = is not and never
could be a class operator.  In Python, any expression of LHS = RHS,
LHS is always a name, and in this statement it is being bound to some
object found by evaluating the right hand side, RHS.

The bit of confusion here is that the in-place operators like +=, -=,
etc. are something of a misnomer - obviously a *name* can't be
incremented or decremented (unlike a pointer in C or C++).  One has to
see that these are really shortcuts for LHS = LHS + RHS, and once
again, our LHS is just a name getting bound to the result of LHS +
RHS.  Is this confusing, or non-intuitive? Maybe. Do you want to write
code in Python? Get used to it.  It is surprising how many times we
think things are intuitive when we really mean they are familiar.
For long-time C and Java developers, it is intuitive that variables
are memory locations, and switching to Python's name model for them is
non-intuitive.

As for your quibble about 3 is not an object, I'm afraid that may be
your own personal set of blinders.  Integer constants as objects is
not unique to Python, you can see it in other languages - Smalltalk
and Ruby are two that I know personally.  Ruby implements a loop using
this interesting notation:

3.times do
   ...do something...
end

Of course, it is a core idiom of the language, and if I adopted Ruby,
I would adopt its idioms and object model.

Is it any odder that 3 is an object than that the string literal
Hello, World! is an object?  Perhaps we are just not reminded of it
so often, because Python's int class defines no methods that are not
__ special methods (type in dir(3) at the Python prompt).  So we
never see any Python code referencing a numeric literal and
immediately calling a method on it, as in Ruby's simple loop
construct.  But we do see methods implemented on str like split(), and
so about above across after against.split() gives me a list of the
English prepositions that begin with a. We see this kind of thing
often enough, we get accustomed to the objectness of string literals.
It gets to be so familiar, it eventually seems intuitive.  You
yourself mentioned that intuition is subjective - unfortunately, the
intuitiveness of a feature is often tied to its value as a coding
concept, and so statements of non-intuitiveness can be interpreted as
a slant against the virtue of that concept, or even against the
language itself.

Once we accept that 3 is an object, we clearly have to stipulate that
there can be no changes allowed to it.  3 must *always* have the value
of the integer between 2 and 4.  So our language invokes the concept
that some classes create instances that are immutable.

For a Python long-timer like Mr. D'Aprano, I don't think he even
consciously thinks about this kind of thing any more; his intuition
has aligned with the Python stars, so he extrapolates from the OP's
suggestion to the resulting aberrant behavior, as he posted it.

You can dispute and rail at this core language concept if you like,
but I think the more entrenched you become in the position that '3 is
an object' is bizarre, the less enjoyable your Python work will be.

-- Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Steven D'Aprano
On Sun, 30 Aug 2009 01:01:37 -0700, Mark Dickinson wrote:

 On Aug 29, 8:03 pm, Steven D'Aprano st...@remove-this-
 cybersource.com.au wrote:
 On Sat, 29 Aug 2009 11:11:43 -0700, zaur wrote:
  I thought that int as object will stay the same object after += but
  with another integer value. My intuition said me that int object
  which represent integer value should behave this way.

 If it did, then you would have this behaviour:

  n = 3                     # bind the name n to the object 3
  saved_id = id(n)          # get the id of the object n += 1        
             # add one to the object 3 assert n == 4             #
  confirm that it has value four assert id(n) == saved_id  # confirm
  that it is the same object m = 3                     # bind the
  name m to the object 3 print m + 1               # but object 3 has
  been modified

 5
 
 I don't see how that follows.

Okay, it follows given Python's caching of small integer objects.

It also follows from the idea that there is one abstract entity which 
English speakers call three and write as 3. There's not two identical 
entities with value 3, or four, or a million of them, only one.

But of course your alternative implementation (where every time the 
Python VM sees the literal 3 it creates a new integer object with that 
value) would also be a valid, albeit inefficient, implementation. To be 
honest, I didn't even think of that.


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Paul McGuire
On Aug 30, 5:42 am, Paul McGuire pt...@austin.rr.com wrote:
 Python binds values to names. Always. In Python, = is not and never
 could be a class operator.  In Python, any expression of LHS = RHS,
 LHS is always a name, and in this statement it is being bound to some
 object found by evaluating the right hand side, RHS.

An interesting side note, and one that could be granted to the OP, is
that Python *does* support the definition of class operator overrides
for in-place assignment operators like += (by defining a method
__iadd__).  This is how numpy's values accomplish their mutability.

 It is surprising how many times we
 think things are intuitive when we really mean they are familiar.
Of course, just as I was typing my response, Steve D'Aprano beat me to
the punch.

Maybe it's time we added a new acronym to this group's ongoing
discussions: PDWTW, or Python doesn't work that way.

-- Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Albert Hopkins
On Sun, 2009-08-30 at 10:44 +, Steven D'Aprano wrote:
 It also follows from the idea that there is one abstract entity which 
 English speakers call three and write as 3. There's not two
 identical 
 entities with value 3, or four, or a million of them, only one.

That's not true.  There are many different 3s in all the parallel
universes. ;)

-a

-- 
http://mail.python.org/mailman/listinfo/python-list


How to install setuptools...egg?

2009-08-30 Thread Rolf

Hi,

I would like to install setuptools for Python2.6 on Windows. 
Unfortunately I could only find setuptools-0.6c9-py2.6.egg but no *.exe 
for Python2.6. And as far as I understand I need setuptools to install a 
Python egg. I would be very appreciative for any help.


Regards

Rolf
--
http://mail.python.org/mailman/listinfo/python-list


Re: a popen question. Please help

2009-08-30 Thread Tim Chase

texts = os.popen('top').readlines()
print texts

It calls the command line top and will print out some texts.
But first I have to press the keyboard q to quit the subprocess top, then 
the texts will be printed, otherwise it just stands by with blank.

Question
is. Do you know how to give q into my python script so that top is
automatically quit immediately or maybe after 1s and print out the texts.


Well as a workaround, my version of top (on Debian) supports a 
-n parameter so you can tell it how many iterations you want it 
to perform before quitting.  So you should be able to just use


  os.popen('top -n1').readlines()

-tkc



--
http://mail.python.org/mailman/listinfo/python-list


Re: a popen question. Please help

2009-08-30 Thread Chris Rebert
On Sun, Aug 30, 2009 at 4:43 AM, Tim Chasepython.l...@tim.thechases.com wrote:
 texts = os.popen('top').readlines()
 print texts

 It calls the command line top and will print out some texts.
 But first I have to press the keyboard q to quit the subprocess top,
 then the texts will be printed, otherwise it just stands by with blank.

 Question
 is. Do you know how to give q into my python script so that top is
 automatically quit immediately or maybe after 1s and print out the texts.

 Well as a workaround, my version of top (on Debian) supports a -n
 parameter so you can tell it how many iterations you want it to perform
 before quitting.  So you should be able to just use

  os.popen('top -n1').readlines()

Hm, interesting. On Mac OS X's (and BSD's?) top, -n instead specifies
the number of processes to list at a time (i.e. list only the top N
processes), which is entirely different.

Cheers,
Chris
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Carl Banks
On Aug 30, 3:34 am, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
 On Sun, 30 Aug 2009 02:33:05 -0500, Derek Martin wrote:
  On Sat, Aug 29, 2009 at 07:03:23PM +, Steven D'Aprano wrote:
  On Sat, 29 Aug 2009 11:11:43 -0700, zaur wrote:

   I thought that int as object will stay the same object after += but
   with another integer value. My intuition said me that int object
   which represent integer value should behave this way.

  If it did, then you would have this behaviour:

  No, you wouldn't; the behavior you described is completely different
  from, and incompatible with, what zaur wrote.

  He's saying that instead of thinking the integer value of 3 itself being
  the object, he expected Python's object model would behave as though the
  entity m is the object, and that object exists to contain an integer
  value.

 What is the entity m?

I think they (Derek and zaur) expect integer objects to be mutable.

It's pretty common for people coming from name is a location in
memory languages to have this conception of integers as an
intermediate stage of learning Python's object system.  Even once
they've understood everything is an object and names are references
to objects they won't have learned all the nuances of the system, and
might still (not unreasonably) think integer objects could be mutable.

However, it'd be nice if all these people didn't post here whining
about how surprising and unintuitive it is and instead just said, ah,
integers are immutable, got it, quietly to themselves.


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to install setuptools...egg?

2009-08-30 Thread Diez B . Roggisch
Rolf rol...@online.de wrote:
 Hi,
 
 I would like to install setuptools for Python2.6 on Windows. 
 Unfortunately I could only find setuptools-0.6c9-py2.6.egg but no
 *.exe 
 for Python2.6. And as far as I understand I need setuptools to install
 a 
 Python egg. I would be very appreciative for any help.


You bootstrap setuptools by downloading  executing ez_setup.py. 


Diez
-- 
http://mail.python.org/mailman/listinfo/python-list


a popen question. Please help

2009-08-30 Thread Joni Lee
Hi all,

I write a small script

texts = os.popen('top').readlines()
print texts

It calls the command line top and will print out some texts.
But first I have to press the keyboard q to quit the subprocess top, then 
the texts will be printed, otherwise it just stands by with blank.

Question
is. Do you know how to give q into my python script so that top is
automatically quit immediately or maybe after 1s and print out the texts.

Thank you



  -- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Carl Banks
On Aug 30, 12:33 am, Derek Martin c...@pizzashack.org wrote:
[snip rant]
 THAT is why Python's behavior with regard to numerical objects is
 not intuitive, and frankly bizzare to me, and I dare say to others who
 find it so.

 Yes, that's right.  BIZZARE.

You mean it's different from how you first learned it.


Carl Banks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to install setuptools...egg?

2009-08-30 Thread Colin J. Williams

Diez B. Roggisch wrote:

Rolf rol...@online.de wrote:

Hi,

I would like to install setuptools for Python2.6 on Windows. 
Unfortunately I could only find setuptools-0.6c9-py2.6.egg but no
*.exe 
for Python2.6. And as far as I understand I need setuptools to install
a 
Python egg. I would be very appreciative for any help.



You bootstrap setuptools by downloading  executing ez_setup.py. 



Diez

You might try, at the command line:
  easy_install setuptools

Colin W.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python for professsional Windows GUI apps?

2009-08-30 Thread William
For wxFormbuilder, does it also support AUI (dockable windows,etc.)?

Thanks,
William

--- On Wed, 8/26/09, Robert Kern robert.k...@gmail.com wrote:

From: Robert Kern robert.k...@gmail.com
Subject: Re: Python for professsional Windows GUI apps?
To: python-list@python.org
Date: Wednesday, August 26, 2009, 7:40 PM

On 2009-08-26 18:08 PM, sturlamolden wrote:
 On 26 Aug, 22:47, David C Ullrichdullr...@sprynet.com  wrote:
 
 Nothing, except lobbying for wxFormBuilder for anyone who still doesn't
 know of it. :)
 
 That's great. But do you know of anything I can use as a
 visual form design tool in wxPython?
 
 Right... I don't know if you are trying to be funny, but as I said
 there is wxFormBuilder...
 
 3.0 generates XRC that you can use with wxPython.
 3.1 beta generates wxPython classes you can subclass.
 
 Honestly, it's the best GUI builder for wxPython I know of.

It's possible that he is not asking for a visual form designer tool *for* 
building a wxPython app, but one that can be used *inside* a wxPython app like 
an IDE or something similar.

-- Robert Kern

I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth.
  -- Umberto Eco

-- http://mail.python.org/mailman/listinfo/python-list



  -- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread Hendrik van Rooyen
On Sunday 30 August 2009 02:20:47 John Machin wrote:
 On Aug 30, 8:46 am, r rt8...@gmail.com wrote:
  Take for instance the Chinese language with it's thousands of
  characters and BS, it's more of an art than a language.  Why do we
  need such complicated languages in this day and time. Many languages
  have been perfected, (although not perfect) far beyond that of Chinese
  language.

 The Chinese language is more widely spoken than English, is quite
 capable of expression in ASCII (r tongzhi shi sha gua) and doesn't
 have those pesky it's/its problems.

  The A-Z char set is flawless!

 ... for expressing the sounds of a very limited number of languages,
 and English is *NOT* one of those.

I suspect that the alphabet is not ideal for representing the sounds of _any_ 
language, and I would look for my proof in the plethora of things that we use 
when writing, other than the bare A-Z.   - Punctuation, diacritics...

But what really started me thinking, after reading this post of John's, read 
with Dennis'. - on the dissimilarity of the spoken and written Chinese - was 
the basic dichotomy of the two systems - a symbol for a sound vs a symbol for 
a word or an idea.

I know that when I read, I do not actually read the characters, I recognize 
words, and only fall back to messing with characters when I hit something 
unfamiliar.

So It would seem to me that r's utopia could sooner be realized if the 
former system were abandoned in favour of the latter. - and Horrors!  The 
language of choice would not be English!

Not that I agree that it would be a Utopia, whatever the language  - more like 
a nightmare of Orwellian proportions - because the language you get taught 
first, moulds the way you think.  And I know from personal experience that 
there are concepts that can be succinctly expressed in one language, that 
takes a lot of wordy handwaving to get across in another.  So diversity would 
be less, creativity would suffer due to lack of cross pollination, and 
progress would slow or stop.

- Hendrik
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: a popen question. Please help

2009-08-30 Thread Tim Chase

 os.popen('top -n1').readlines()


Hm, interesting. On Mac OS X's (and BSD's?) top, -n instead specifies
the number of processes to list at a time (i.e. list only the top N
processes), which is entirely different.


[reaching over to my Mac] Looks like top there supports a -l 
parameter which does something similar.


Darn standards :-/

-tkc




--
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread r
On Aug 29, 11:05 pm, Anny Mous b1540...@tyldd.com wrote:
(snip)
 How do we distinguish resume from résumé without accents?

This is another quirk of some languages that befuddles me. What is
with the ongoing language pronunciation tutorial some languages have
turned into -- French is a good example (*puke*). Do you *really* need
those squiggly lines and cues above letters so you won't forget how to
pronounce a word. Pure ridiculousness!

 Even when we succeed in banning all languages that can't be written using
 A-Z, what do we do about the vast number of legacy documents? How do we
 write about obsolete English letters like Ð and Þ without Unicode?

Who gives a fig about obsolete languages, thank god they are dead and
let's move on!!


  Some may say well how can we possibly force countries/people to speak/
  code in a uniform manner? Well that's simple, you just stop supporting
  their cryptic languages by dumping Unicode and returning to the
  beautiful ASCII and adopting English as the universal world language.
  Why English? Well because it is so widely spoken.

 World population: 6.7 billion

 Number of native Mandarin speakers: 873 million
 Number of native Hindi speakers: 370 million
 Number of native Spanish speakers: 350 million
 Number of native English speakers: 340 million

 Total number of Mandarin speakers: 1051 million
 Total number of English speakers: 510 million

 http://www.vistawide.com/languages/top_30_languages.htm

I was actually referring to countries where the majority of people
*actually* know what a computer is and how to use it... If there
culture has not caught up with western technology yet they are doomed
to the fate of native American Indians.

 Whichever way you look at it, we should all convert to Mandarin, not
 English. Looks like we still need Unicode.

see my last comment

(snip entertaining assumptions)

 Yes, because language differences have utterly destroyed us so many times in
 the past!

 Have you thought about the difference between China, with one culture and
 one spoken language for thousands of years, and Europe, with dozens of
 competing cultures, competing governments, and alternate languages for just
 as long? If multiple languages are so harmful, why was it the British,
 French, Japanese, Russians, Germans, Italians, Austrians, Hungarians and
 Americans who were occupying China during the Opium Wars and the Boxer
 Rebellion, instead of the other way around?

 Strength comes from diversity, not monoculture.

No strength comes from superior firepower. The Chinese culture stop
evolving thousands of years ago. Who invented gun powder? Yes the
Chinese and all they could do with it was create fireworks. Europeans
took gun powered and started a revolution that changes the world
forever -- for better and for worse, but that is how advancements
work. It wasn't until western influence came along and finally nudged
china into the 21st century. Europeans seek out technology and aren't
dragged down by an antiquated culture which is good for innovation. If
China with it's huge population thought like a European, they would
rule the earth for 10,000 years.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to install setuptools...egg?

2009-08-30 Thread Christian Heimes
Colin J. Williams wrote:
 You might try, at the command line:
easy_install setuptools


That's not going to work. setuptools provides the easy_install command.
If you have the easy_install command than setuptools is already installed.

Christian

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread r
On Aug 30, 3:33 am, Thorsten Kampe thors...@thorstenkampe.de wrote:
[snip ridiculous trolling]
 Thorsten

Hmm, I wonder who's sock puppet you are Thorsten?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why does this group have so much spam?

2009-08-30 Thread Byung-Hee HWANG
casebash walkr...@gmail.com writes:

 So much of it could be removed even by simple keyword filtering.

Use python-list@python.org [1], instead.

[1] http://mail.python.org/mailman/listinfo/python-list

-- 
He's a responsible man in his own way.
-- Michael Corleone, Chapter 25, page 363
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread zaur
On 29 авг, 23:03, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
 On Sat, 29 Aug 2009 11:11:43 -0700, zaur wrote:
  I thought that int as object will stay the same object after += but with
  another integer value. My intuition said me that int object which
  represent integer value should behave this way.

 If it did, then you would have this behaviour:

  n = 3                     # bind the name n to the object 3
  saved_id = id(n)          # get the id of the object
  n += 1                    # add one to the object 3
  assert n == 4             # confirm that it has value four
  assert id(n) == saved_id  # confirm that it is the same object
  m = 3                     # bind the name m to the object 3
  print m + 1               # but object 3 has been modified

 5

 This would be pretty disturbing behaviour, and anything but intuitive.

 Fortunately, Python avoids this behaviour by making ints immutable. You
 can't change the object 3 to have any other value, it will always have
 value three, and consequently n+=1 assigns a new object to n.

 --
 Steven

This behavior is because small integers are cached internally. See

Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type help, copyright, credits or license for more information.
 a=1
 c=1
 d=1
 e=1
 id(a),id(c),id(d),id(e)
(16793992, 16793992, 17067336, 17067276)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread r
On Aug 30, 7:11 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
(snip)
 Not that I agree that it would be a Utopia, whatever the language  - more like
 a nightmare of Orwellian proportions - because the language you get taught
 first, moulds the way you think.  And I know from personal experience that
 there are concepts that can be succinctly expressed in one language, that
 takes a lot of wordy handwaving to get across in another.  So diversity would
 be less, creativity would suffer due to lack of cross pollination, and
 progress would slow or stop.

 - Hendrik

What makes you think that diversity is lost with a single language? I
say more pollination will occur and the seed will be more potent since
all parties will contribute to the same pool. Sure there will be
idioms of different regions but that is to be expected. But at least
then i could make international crank calls without the language
barrier ;-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sqlite format string

2009-08-30 Thread Sergio Charpinel Jr.
Thank you very much.

2009/8/30 Cameron Simpson c...@zip.com.au

 On 29Aug2009 17:27, Sergio Charpinel Jr. sergiocharpi...@gmail.com
 wrote:
 | Hi,
 | I have this statement cursor.execute(SELECT * from session_attribute
 WHERE
 | sid=%s, ( user ))
 | and I'm receiving this error :
 |
 | TypeError: not all arguments converted during string formatting
 |
 | What is wrong ?

 This:

  ( user )

 is not a tuple containing the element user. It's just user.

 This:

  ( user, )

 is what you want.
 --
 Cameron Simpson c...@zip.com.au DoD#743
 http://www.cskk.ezoshosting.com/cs/

 [Alain] had been looking at his dashboard, and had not seen me, so I
 ran into him. - Jean Alesi on his qualifying prang at Imola '93




-- 
Sergio Roberto Charpinel Jr.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to install setuptools...egg?

2009-08-30 Thread r
On Aug 30, 7:08 am, Colin J. Williams c...@ncf.ca wrote:

 You might try, at the command line:
    easy_install setuptools

Wait maybe you should try this command

 help(setuptools)

:-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Albert Hopkins
On Sun, 2009-08-30 at 04:49 -0700, Carl Banks wrote:
 It's pretty common for people coming from name is a location in
 memory languages to have this conception of integers as an
 intermediate stage of learning Python's object system.  Even once
 they've understood everything is an object and names are references
 to objects they won't have learned all the nuances of the system, and
 might still (not unreasonably) think integer objects could be mutable.
 
I agree.  Python (and other similar languages?) are different in that.
'x' does not point to an area in memory, where you can do anything with
that area.  But in Python there are objects, and they are references
in memory that some magical reference counter keeps track of for us
(and that's a wonderful thing).  And what is 'x'?  Well 'x' is just some
label that just so happens to have the privelage of being associated
with this unnamed object.  'x' could just as easily associate itself
with another object.

I think that the Blue programming language, which I have been looking at
lately, makes this distinction even clearer.  For example, functions are
not defined by names at all.  Instead of

def funcname(): ...

You have

func{...};

If you actually want to be able to reference the function later (as you
probably would) then it's just a simple assignment just like any other
assignment:

funcname = func{...};

But i think it makes it more clear that funcname just so happens to
reference this object that's a function.  It's the same basic philosophy
when applied to methods:

MyClass = sys.class();
MyClass.my_method = func{...};

Blue also has interesting, simple rules wrt scopes.  It's a surprisingly
small, simple language (yet in a very early stage of development.

 However, it'd be nice if all these people didn't post here whining
 about how surprising and unintuitive it is and instead just said, ah,
 integers are immutable, got it, quietly to themselves.

Yes, when I was first learning Python, at least the book I used made it
very clear when introducing a new type to specify that type as mutable
or immutable.  It's a very core concept to Python.  If you choose to
ignore it or refuse to understand it then you are asking for trouble.

-a


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: About diagram and python

2009-08-30 Thread catafest
This is the software :
http://projects.gnome.org/dia/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Parse xml file

2009-08-30 Thread Mag Gam
XML is a structured file. I never knew you can read it line by line
and process. iterparse()

More info on iterparse():
http://effbot.org/zone/element-iterparse.htm


On Thu, Aug 27, 2009 at 10:39 AM, Stefan Behnelstefan...@behnel.de wrote:
 loial wrote:
 Is there a quick way to retrieve data from an xml file in python 2.4,
 rather than read the whole file?

 ElementTree is available as an external package for Py2.4 (and it's in the
 stdlib xml.etree package since 2.5).

 It's pretty much the easiest way to get data out of XML files.

 If your statement rather than read the whole file was referring to the
 file size, note that the C implementation cElementTree of ElementTree is
 very memory efficient, so you might still get away with just reading the
 whole file into memory. There's also the iterparse() function which
 supports iterative parsing of an XML file and thus allows intermediate
 cleanup of used data.

 Stefan
 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


How i follow tree folders from url

2009-08-30 Thread catalinf...@gmail.com
Hello !

 I wanna use python to follow the tree folders from one url to get
data about dirs and folders.
 Example :
 If url is www.site.com/first/ and 
 first is first folder with next subfolders 01,02,03
 The result of script should be :

 www.site.com/first/01/
 www.site.com/first/02/
 www.site.com/first/03/

What is a easy way to make this ?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread Paul Boddie
On 30 Aug, 14:49, r rt8...@gmail.com wrote:

 It can be made better and if that means add/removing letters or
 redefining what a letter represents i am fine with that. I know first
 hand the hypocrisy of the English language. I am thinking more on the
 lines of English redux!

Elsewhere in this thread you've written...

This is another quirk of some languages that befuddles me. What is
with the ongoing language pronunciation tutorial some languages have
turned into -- French is a good example (*puke*). Do you *really* need
those squiggly lines and cues above letters so you won't forget how to
pronounce a word. Pure ridiculousness!

And, in fact, there have been schemes to simplify written English such
as Initial Teaching Alphabet:

http://en.wikipedia.org/wiki/Initial_Teaching_Alphabet

I imagine that this is the first time you've heard of it, though.

[...]

 We already live in a Orwellian language nightmare. Have you seen much
 change to the English language in your lifetime? i haven't.

Then you aren't paying attention. Especially in places where English
isn't the first language, there is a lot of modification of English
that is then considered an acceptable version of the language - this
is one way in which languages change.

Elsewhere, you wrote this...

What makes you think that diversity is lost with a single language? I
say more pollination will occur and the seed will be more potent since
all parties will contribute to the same pool.

Parties are contributing to the same language already. It's just not
the only language that they contribute to.

From what you've written, I get the impression that you don't really
know any other languages, don't have much experience with non-native
users of your own language, are oblivious to how languages change, and
are oblivious to the existence of various attempts to improve the
English language in the past in ways similar to those you appear to
advocate, albeit incoherently: do you want to know how to pronounce a
word from its spelling or not?

Add to that a complete lack of appreciation for the relationship
between language and culture, along with a perverted application of
evolutionary models to such things, and you come across as a lazy
cultural supremacist who regards everyone else's language as
superfluous apart from his own. If you're just having problems with
UnicodeDecodeError, at least have the honesty to say so instead of
parading something not too short of bigotry in a public forum.

Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to install setuptools...egg?

2009-08-30 Thread Mike
 I would like to install setuptools for Python2.6 on Windows.

1. Download setuptools-0.6c9-py2.6.egg
2. Download setuptools-0.6c9.tar.gz
3. Use 7-zip from  http://www.7-zip.org/ to extract ez_setup.py from
setuptools-0.6c9.tar.gz
4. In a directory that contains setuptools-0.6c9-py2.6.egg and
ez_setup.py run the command python ez_setup.py
5. Add C:\Python26\Scripts to your path to run easy_install

Mike
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Permanently adding to the Python path in Ubuntu

2009-08-30 Thread Chris Colbert
I don't want to have to modify the path in each and every application.

There has to be a way to do this...

Personally, I don't agree with the Debian maintainers in the order
they import anyway; it should be simple for me to overshadow system
packagers. But that's another story.

P.S. my first name is Steven!

Cheers,

Chris

On Sat, Aug 29, 2009 at 11:51 PM, Sean DiZazzohalf.ital...@gmail.com wrote:
 On Aug 29, 5:39 pm, Chris Colbert sccolb...@gmail.com wrote:
 I'm having an issue with sys.path on Ubuntu. I want some of my home
 built packages to overshadow the system packages. Namely, I have built
 numpy 1.3.0 from source with atlas support, and I need it to
 overshadow the system numpy 1.2.1 which I had to drag along as a
 dependency for other stuff. I have numpy 1.3.0 installed into
 /usr/local/lib/python2.6/dist-packages/. The issue is that this
 directory is added to the path after the
 /usr/lib/python2.6/dist-packages/ is added, so python doesnt see my
 version of numpy.

 I have been combating this with a line in my .bashrc file:

 export PYTHONPATH=/usr/local/lib/python2.6/dist-packages

 So when I start python from the shell, everything works fine.

 Problems show up when python is not executed from the shell, and thus
 the path variable is never exported. This can occur when I have
 launcher in the gnome panel or i'm executing from within wing-ide.

 Is there a way to fix this so that the local dist-packages is added to
 sys.path before the system directory ALWAYS? I can do this by editing
 site.py but I think it's kind of bad form to do it this way. I feel
 there has to be a way to do this without root privileges.

 Any ideas?

 Cheers,

 Chris

 I think you can modify sys.path inside your application.

 Maybe this will work (at the top of your script):


 import sys
 sys.path[0] = /usr/local/lib/python2.6/dist-packages

 import numpy


 PS.  Say hi to Steven for me!

 ~Sean
 --
 http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Permanently adding to the Python path in Ubuntu

2009-08-30 Thread Christian Heimes
Chris Colbert wrote:
 Is there a way to fix this so that the local dist-packages is added to
 sys.path before the system directory ALWAYS? I can do this by editing
 site.py but I think it's kind of bad form to do it this way. I feel
 there has to be a way to do this without root privileges.
 
 Any ideas?

Have you read my blog entry about my PEP 370?
http://lipyrary.blogspot.com/2009/08/how-to-add-new-module-search-path.html

Christian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread Hendrik van Rooyen
On Sunday 30 August 2009 15:37:19 r wrote:

 What makes you think that diversity is lost with a single language? 

I am quite sure of this - it goes deeper than mere regional differences - your 
first language forms the way you think -  and if we all get taught the same 
language, then on a very fundamental level we will all think in a similar 
way, and that loss will outweigh the normal regional or cultural differences 
on which you would have to rely for your diversity.

Philip Larkin has explained the effect better than I can:

They f*ck you up, your mom and dad,
 They do not mean to, but they do.
 They fill you with the faults they had,
 And add some extra, just for you.

 I 
 say more pollination will occur and the seed will be more potent since
 all parties will contribute to the same pool. 

I think this effect, while it might be real, would be swamped by the loss of 
the real diversity.

 Sure there will be 
 idioms of different regions but that is to be expected. But at least
 then i could make international crank calls without the language
 barrier ;-)

You can make crank calls _now_ without a language barrier - heavy breathing is 
a universally understood idiom.
:-)

- Hendrik
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread zaur
On 30 авг, 15:49, Carl Banks pavlovevide...@gmail.com wrote:
 I think they (Derek and zaur) expect integer objects to be mutable.

 It's pretty common for people coming from name is a location in
 memory languages to have this conception of integers as an
 intermediate stage of learning Python's object system.  Even once
 they've understood everything is an object and names are references
 to objects they won't have learned all the nuances of the system, and
 might still (not unreasonably) think integer objects could be mutable.

 However, it'd be nice if all these people didn't post here whining
 about how surprising and unintuitive it is and instead just said, ah,
 integers are immutable, got it, quietly to themselves.

 Carl Banks

Very expressive.

I use python many years. And many years I just took python int as they
are.
I am also not think about names as reference to objects and so on.

So this isn't the case.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sun, Aug 30, 2009 at 10:34:17AM +, Steven D'Aprano wrote:
  He's saying that instead of thinking the integer value of 3 itself being
  the object, he expected Python's object model would behave as though the
  entity m is the object, and that object exists to contain an integer
  value.  

 What is the entity m?

The entity m is an object.  Objects, in computer science,  are
abstractions created by humans to make solving a large class of
problems easier to think about.  An object is a piece of data, upon
which you can perform programmatic actions, which are grouped together
with the values contained in that data.  It's an abstraction which
translates, in the physical sense, to a group of memory locations with
a reference in a symbol table.

 Ah wait, I think I get it... is m a memory location? 

No, it isn't.  It is an abstraction in the programmer's mind that sits
on top of some memory.  For that matter, the memory location is
itself an abstraction.  It is not a memory location, but a particular
series of circuits which either have current or don't.  It is simply
convenient for us to think of it as a memory location.

 That would be how Pascal and C (and presumably other languages)
 work, but not Python or Ruby or even VB (so I'm told) and similar
 languages.

Well, except that, in fact, they do work that way.  They simply
present a different abstraction to the programmer than C or other
languages.  They have to work that way, at the lowest level, because
that is how the hardware works.

  Numbers are fundamentally different from objects.  The number 3 is a
  symbol of the idea of the existence of three countable objects.  It can
  not be changed 
 
 Doesn't this contradict your claim that people expect to be able to 
 mutate numbers? That you should be able to do this?

This is where you continually fail.  There is no contradiction at all.
What I'm saying is that in my view, numbers CAN'T mutate; they are not
objects!  They are values, which are a means of describing objects.
Only the objects which hold the values can mutate.  However in Python
they don't, and can't, but they EASILY could with a different design.
You, however, seem to be completely stuck on Python's behavior with
regard to numeric objects, and fail to see past that.  Python's model
is only one abstraction, among multiple possibilities.

 You can't have it both ways -- if people think of objects as
 mutable, and think of numbers as not-objects and unchanging, then
 why oh why would they find Python's numeric behaviour to be
 unintuitive?

Because in Python, they ARE objects, which they think should be
mutable, but in Python when they try to change the *value* of the
object, they don't get the same object with a different value; they
get a completely different object.  This is counter to their
experience.  If you don't like the Buick example, then use algebra.
We've been down this road before, so I'm probably wasting my time...
In algebra, you don't assign a name to a value, you assign a value to
a variable.  You can, in a different problem, assign a different value
to that variable, but the variable didn't change; only its value did.
In Python, it's the opposite.

 What I think is that some people, such as you and Zaur, have *learned* 
 from C-like languages that numbers are mutable not-objects, and you've 
 learned it so well that you've forgotten that you ever needed to learn 
 it. 

No, this is precisely why I provided the real-world examples -- to
illustrate to you that there was no need to learn it in computer
science, because the concept applies in the real world quite
intuitively in every-day situations.  I think rather it is YOU who
have learned the concept in Python, and since then fail to imagine any
other possible interpretation of an object, and somehow have
completely forgotten the examples you encountered before Python, from
algebra and from the real world.

 Human beings are excellent at reifying abstract things into (imaginary) 
 objects. 

I don't know what the word reifying means, but irrelevant.  Such
things are abstract, and in fact not objects.

 No, the length of a car is an object which *is* a length, it doesn't 
 *have* a length.

It is not an object.  It is an abstract idea used as a description of
an object.

 None of this explains why you would expect to be able to mutate the
 value three and turn it into four.

Again, you fail.  I *DO NOT* expect that.  I expect to be able to
mutate the object m, changing its value from 3 to 4.

 I think you have confused yourself. 

No Steven, on this topic, it is only you who have been confused,
perpetually.  Although, it could be said that Python's idea of what an
object is also is itself confused...  Python (or at least the docs)
actually refrains from formally defining an object.  The docs only say
that an object has an identity, a name, and a value.  Well, OK... so 3
is an object.  You can 

Re: break unichr instead of fix ord?

2009-08-30 Thread Nobody
On Sun, 30 Aug 2009 06:54:21 +0200, Dieter Maurer wrote:

 What you propose would break the property unichr(i) always returns
 a string of length one, if it returns anything at all.
 
 But getting a ValueError in some builds (and not in others)
 is rather worse than getting unicode strings of different length

Not necessarily. If the code assumes that unichr() always returns a
single-character string, it will silently produce bogus results when
unichr() returns a pair of surrogates. An exception is usually preferable
to silently producing bad data.

If unichr() returns a surrogate pair, what is e.g. unichr(i).isalpha()
supposed to do?

Using surrogates is fine in an external representation (UTF-16), but it
doesn't make sense as an internal representation.

Think: why do people use wchar_t[] rather than a char[] encoded in UTF-8?
Because a wchar_t[] allows you to index *characters*, which you can't do
with a multi-byte encoding. You can't do it with a multi-*word* encoding
either.

UCS-2 and UTF-16 are superficially so similar that people forget that
they're completely different beasts. UCS-2 is fixed-length, UTF-16 is
variable-length. This makes UTF-16 semantically much closer to UTF-8 than
to UCS-2 or UCS-4.

If your wchar_t is 16 bits, the only sane solution is to forego support
for characters outside of the BMP.

The alternative is to process wide strings in exactly the same way that
you process narrow (mbcs) strings; e.g. extracting character N requires
iterating over the string from the beginning until you have counted N-1
characters. This provides no benefit over using narrow strings except for
a slight performance gain from halving the number of iterations. You still
end up with indexing being O(n) rather than O(1).

-- 
http://mail.python.org/mailman/listinfo/python-list


Thread Pool

2009-08-30 Thread Vitaly Babiy
Hey,
Any one know of a good thread pool library. I have tried a few but they
don't seem to clean up after them selfs well.

Thanks,
Vitaly Babiy
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Rhodri James

On Sun, 30 Aug 2009 17:37:49 +0100, zaur szp...@gmail.com wrote:


On 30 авг, 15:49, Carl Banks pavlovevide...@gmail.com wrote:

I think they (Derek and zaur) expect integer objects to be mutable.

It's pretty common for people coming from name is a location in
memory languages to have this conception of integers as an
intermediate stage of learning Python's object system.  Even once
they've understood everything is an object and names are references
to objects they won't have learned all the nuances of the system, and
might still (not unreasonably) think integer objects could be mutable.

However, it'd be nice if all these people didn't post here whining
about how surprising and unintuitive it is and instead just said, ah,
integers are immutable, got it, quietly to themselves.

Carl Banks


Very expressive.

I use python many years. And many years I just took python int as they
are.
I am also not think about names as reference to objects and so on.


Then you are doomed to surprises such as this.

--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sun, Aug 30, 2009 at 03:42:06AM -0700, Paul McGuire wrote:
 Python binds values to names. Always. 

No, actually, it doesn't.  It binds *objects* to names.  This
distinction is subtle, but important, as it is the crux of why this is
confusing to people.  If Python is to say that objects have values,
then the object can not *be* the value that it has, because that is a
paradoxical self-reference.  It's an object, not a value.

 Is it any odder that 3 is an object than that the string literal
 Hello, World! is an object?  

Yes.  Because 3 is a fundamental bit of data that the hardware knows
how to deal with, requiring no higher level abstractions for the
programmer to use it (though certainly, a programming language can
provide them, if it is convenient).  Hello, World! is not.  They are
fundamentally different in that way.

 For a Python long-timer like Mr. D'Aprano, I don't think he even
 consciously thinks about this kind of thing any more; his intuition
 has aligned with the Python stars, so he extrapolates from the OP's
 suggestion to the resulting aberrant behavior, as he posted it.

I'm sure that's the case.  But it's been explained to him before, and
yet he still can't seem to comprehend that not everyone immediately
gets this behavior, and that this is not without good reason.

So, since it *has* been explained to him before, it's somewhat
astonishing that he would reply to zaur's post, saying that the
behavior zaur described would necessarily lead to the insane behavior
that Steven described.  When he makes such statements, it's tantamount
to calling the OP an idiot.  I find that offensive, especially
considering that Steven's post displayed an overwhelming lack of
understanding of what the OP was trying to say.

 You can dispute and rail at this core language concept if you like,
 but I think the more entrenched you become in the position that '3 is
 an object' is bizarre, the less enjoyable your Python work will be.

While I did genuinely find the behavior bizarre when I encountered it,
and honestly still do, I learned it quickly and moved past it.  I'm
not suggesting that it be changed, and I don't feel particularly
strongly that it even should change.  It's not so much the language
I'm railing against, but the humans...

-- 
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D



pgpacvVblOJRP.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (Simple?) Unicode Question

2009-08-30 Thread Nobody
On Sun, 30 Aug 2009 02:36:49 +, Steven D'Aprano wrote:

 So long as your terminal has a sensible encoding, and you have a good
 quality font, you should be able to print any string you can create.
 
 UTF-8 isn't a particularly sensible encoding for terminals.
 
 Did I mention UTF-8?
 
 Out of curiosity, why do you say that UTF-8 isn't sensible for terminals?

I don't think I've ever seen a terminal (whether an emulator running on a
PC or a hardware terminal) which supports anything like the entire Unicode
repertoire, along with right-to-left writing, complex scripts, etc. Even
support for double-width characters is uncommon.

If your terminal can't handle anything outside of ISO-8859-1, there isn't
any advantage to using UTF-8, and some disadvantages; e.g. a typical Unix
tty driver will delete the last *byte* from the input buffer when you
press backspace (Linux 2.6.* has the IUTF8 flag, but this is non-standard).

Historically, terminal I/O has tended to revolve around unibyte encodings,
with everything except the endpoints being encoding-agnostic. Anything
which falls outside of that is a dog's breakfast; it's no coincidence
that the word for messed-up text (arising from an encoding mismatch)
was borrowed from Japanese (mojibake).

Life is simpler if you can use a unibyte encoding. Apart from anything
else, the failure modes tend to be harmless. E.g. you get the wrong glyph
rather than two glyphs where you expected one. On a 7-bit channel, you get
the wrong printable character rather than a control character (this is why
ISO-8859-* reserves \x80-\x9F as control codes rather than using them as
printable characters).

 And Unicode font is an oxymoron. You can merge a whole bunch of fonts
 together and stuff them into a TTF file; that doesn't make them a
 font, though.
 
 I never mentioned Unicode font either. In any case, there's no reason 
 why a skillful designer can't make a single font which covers the entire 
 Unicode range in a consistent style.

Consistency between unrelated scripts is neither realistic nor
desirable.

E.g. Latin fonts tend to use uniform stroke widths unless they're
specifically designed to look like handwriting, whereas Han fonts tend to
prefer variable-width strokes which reflect the direction.

 The main advantage of using Unicode internally is that you can associate
 encodings with the specific points where data needs to be converted
 to/from bytes, rather than having to carry the encoding details around
 the program.
 
 Surely the main advantage of Unicode is that it gives you a full and 
 consistent range of characters not limited to the 128 characters provided 
 by ASCII?

Nothing stops you from using other encodings, or from using multiple
encodings. But using multiple encodings means keeping track of the
encodings. This isn't impossible, and it may produce better results (e.g.
no information loss from Han unification), but it can be a lot more work.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sun, Aug 30, 2009 at 04:26:54AM -0700, Carl Banks wrote:
 On Aug 30, 12:33 am, Derek Martin c...@pizzashack.org wrote:
 [snip rant]

I was not ranting.  I was explaining a perspective.

  THAT is why Python's behavior with regard to numerical objects is
  not intuitive, and frankly bizzare to me, and I dare say to others who
  find it so.
 
  Yes, that's right.  BIZZARE.
 
 You mean it's different from how you first learned it.

I mean exactly that I find it strikingly out of the ordinary; odd,
extravagant, or eccentric in style or mode as Webster's defines the
word.  Whether it is so because it is different from how I first
learned it, or for some other reason, it is so nonetheless.  I have
elsewhere gone into great detail about why I find it so.  If you need
it to be simple, then feel free to simplify it.

-- 
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D



pgpDMB4n3PKex.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread OKB (not okblacke)
Derek Martin wrote:

 If Python is to say that objects have values,
 then the object can not *be* the value that it has, because that is a
 paradoxical self-reference.  It's an object, not a value.

But does it say that objects have values?  I don't see where you 
get this idea.  Consider this code:

class A(object):
pass

class B(object):
x = 0

a = A()
b = B()
b2 = B()
b2.x = a

What is the value of the object now bound to the name a?  What 
about the value of the object bound to b, or b2?

I would say that in Python, objects do not have values.  Objects 
are values.

-- 
--OKB (not okblacke)
Brendan Barnwell
Do not follow where the path may lead.  Go, instead, where there is
no path, and leave a trail.
--author unknown
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IDE for python similar to visual basic

2009-08-30 Thread r
On Aug 28, 5:19 pm, qwe rty hkh00...@gmail.com wrote:
 i have been searching for am IDE for python that is similar to Visual
 Basic but had no luck.shall you help me please?

Hello qwenbsp;rty,

I remember my first days with GUI programming and thinking to myself;
how on earth can i write GUI code without a MS style GUI builder? Not
to long after that i was coding up some pretty spectacular GUI's from
nothing more than source code and loving it.

[Warning: the following is only opinion!]
I think a point and click GUI builder (although some may disagree) is
actually detrimental to your programming skills. The ability to
visualize the GUI only from the source code as you read it, is as
important to a programmer as site reading sheet music is to a
musician. And I like to program with the training wheels off.
-- 
http://mail.python.org/mailman/listinfo/python-list


Non-deterministic computing (was: What python can NOT do?)

2009-08-30 Thread Joshua Judson Rosen
Steven D'Aprano st...@remove-this-cybersource.com.au writes:

 On Sat, 29 Aug 2009 05:37:34 +0200, Tomasz Rola wrote:
 
  My private list of things that when implemented in Python would be
  ugly to the point of calling it difficult:
  
  1. AMB operator - my very favourite. In one sentence, either language
  allows one to do it easily or one would not want to do it (in an ugly
  way).
  
  http://www.randomhacks.net/articles/2005/10/11/amb-operator
 
 
 Fascinating, but I don't exactly see how that's actually *useful*. It 
 strikes me of combining all the benefits of COME FROM with the potential 
 performance of Bogosort, but maybe I'm being harsh. 

There's a chapter on this (non-deterministic computing in general,
and `amb' in particular) in Abelson's  Sussman's book,
`Structure and Interpretation of Computer Programs':

http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-28.html#%_sec_4.3

It's an interesting read (the chapter, as well as the rest of the book).

 On the other hand, it sounds rather like Prolog-like declarative 
 programming. I fear that, like Prolog, it risks massive performance 
 degradation if you don't apply the constraints in the right order.

One of the classic arguments in the other direction is that
imperative programming (as is common in Python ;)) risks
massive *incorrect results* if you don't apply the side-effects
in the right order :)

-- 
Don't be afraid to ask (Lf.((Lx.xx) (Lr.f(rr.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What python can NOT do?

2009-08-30 Thread Nobody
On Sat, 29 Aug 2009 23:07:17 +, exarkun wrote:

Personally, I consider Python to be a good language held back by
too-close ties to a naive interpreter implementation and the lack
of a formal standard for the language.

Name one language under active development that has not been harmed by a
formal standard.  (I think C doesn't count -- there was relatively little
development of C after the standards process started.)
 
 I think you must mean harmed by a formal standard more than it has been 
 helped, since that's clearly the interesting thing.
 
 And it's a pretty difficult question to answer.  How do you quantify the 
 harm done to a language by a standarization process?  How do you 
 quantify the help?  These are extremely difficult things to measure 
 objectively.

For a start, you have to decide how to weight the different groups of
users.

For an application which is designed for end users and will be in a
permanent state of flux, dealing with revisions to the language or its
standard libraries are likely to be a small part of the ongoing
development effort.

For libraries or middleware which need to maintain a stable interface, or
for code which needs extensive testing, documentation, audits, etc, even a
minor update can incur significant costs.

Users in the latter group will prefer languages with a stable and rigorous
specification, and will tend to view any flexibility granted to the
language implementors as an inconvenience.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sun, Aug 30, 2009 at 03:52:36AM -0700, Paul McGuire wrote:
  It is surprising how many times we
  think things are intuitive when we really mean they are familiar.

 Of course, just as I was typing my response, Steve D'Aprano beat me to
 the punch.

Intuition means The power or faculty of attaining to direct knowledge
or cognition without evident rational thought and inference.  Very
naturally, things which behave in a familiar manner are intuitive.
Familiar and intuitive are very closely tied.  Correspondingly, when
things look like something familiar, but behave differently, they are
naturally unintuitive.

-- 
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D



pgpMl4G8ABoo7.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: your favorite debugging tool?

2009-08-30 Thread Michiel Overtoom

Esmail wrote:


What is your favorite tool to help you debug your
code? 


import pdb
pdb.set_trace()

pdb has commands to inspect code, variables, set breakpoints, watches, 
walk up and down stack frames, single-step through the program, run the 
rest of the function, run until return, etc...


http://www.ferg.org/papers/debugging_in_python.html

http://onlamp.com/pub/a/python/2005/09/01/debugger.html

http://plone.org/documentation/how-to/using-pdb

http://docs.python.org/library/pdb.html

Greetings,

--
The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing. - Vinod Valloppillil
http://www.catb.org/~esr/halloween/halloween4.html
--
http://mail.python.org/mailman/listinfo/python-list


Re: Is behavior of += intentional for int?

2009-08-30 Thread Derek Martin
On Sun, Aug 30, 2009 at 05:43:42PM +, OKB (not okblacke) wrote:
 Derek Martin wrote:
 
  If Python is to say that objects have values,
  then the object can not *be* the value that it has, because that is a
  paradoxical self-reference.  It's an object, not a value.
 
   But does it say that objects have values?  I don't see where you 
 get this idea.  

Yes, it does say that.  Read the docs. :)

http://docs.python.org/reference/datamodel.html

(paragraph 2)


 class A(object):
   pass

 a = A()

   What is the value of the object now bound to the name a

In Python, the value of objects depends on the context in which it is
evaluated.  But when you do that, you're not getting a value that is
equivalent to object, but of some property of the object.  The object
has no intrinsic value until it is evaluated.  In that sense, and as
used by the python docs, I would say that the value of the object a is
true -- you can use it in boolean expressions, and it will evaluate
as such.  

   I would say that in Python, objects do not have values.
 Objects are values.

You can say that, but if you do you're using some definition of
value that's only applicable in Python and programming languages
which behave the same way.  It would be more correct to say that an
object is a collection of arbitrary data, which has a type and an
identity, and that the data in that collection has a value that
evaluates in context.  An object is an abstract collection of data,
and abstractions have no value.  You can not measure them in any
meaningful way.  The data contained in the collection does, however,
have a value.  When you reference an object in an expression, what you
get is not the value of the object, but the value of some peice of
data about, or contained in, that object.

It is this property of objects, that the value evaluated depends on
the context, that I think demonstrates that an object is *not* a
value.  Values never change, as we've said in this thread: 3 is always
3.  'a' is always 'a'.  But an object x can evaluate to many different
values, depending on how it is used.  The definition of the object
would need to allow for it to do so, but Python allows that, and even
encourages it.

-- 
Derek D. Martin
http://www.pizzashack.org/
GPG Key ID: 0x81CFE75D



pgpPXZKHxLKRw.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread Nobody
On Sat, 29 Aug 2009 22:14:55 -0700, John Nagle wrote:

 (I wish the HTML standards people would do the same.  HTML 5
 should have been ASCII only (with the  escapes if desired)
 or Unicode.  No Latin-1, no upper code pages, no JIS, etc.)

IOW, you want the HTML standards to continue to be meaningless documents,
and HTML to continue to mean what browsers support.

Because that would be the likely consequence of such a stance. Japanese
websites will continue to use Shift-JIS, Japanese cellphones (or
Scandanavian cellphones aimed at the Japanese market, for that matter)
will continue to render websites which use Shift-JIS, and HTML 5 will be
just as much a pure academic exercise as all of the other HTML standards.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re:a popen question. Please help

2009-08-30 Thread ivanko . rus
First, I think you should use subprocess.Popen (it's recommended by  
PEP-324) instead of os.popen. For example:


p = subprocess.Popen([top], stdout = PIPE)
p.stdout.readlines()

And to write to stdin (in your case q) you can use p.stdin.write(q), or  
terminate the process with p.terminate(), or just specify the -n option  
(the number of iterations) to the value you desire. It's done in that way:  
subprocess.Popen([top,-n 1], stdout=PIPE)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Annoying octal notation

2009-08-30 Thread Hendrik van Rooyen
On Monday 24 August 2009 16:14:25 Derek Martin wrote:

 In fact, now that I think of it...

 I just looked at some old school papers I had tucked away in a family
 album.  I'm quite sure that in grammar school, I was tought to use a
 date format of 8/9/79, without leading zeros.  I can't prove it, of
 course, but feel fairly sure that the prevalence of leading zeros in
 dates occured only in the mid to late 1980's as computers became more
 prevalent in our society (no doubt because thousands of cobol

I was one of those COBOL programmers, and the time was around the end of the 
sixties, running into the seventies.  And the reason for leading zeroes on 
dates was the punched card, and its handmaiden, the data entry form, with a 
nice little block for every character. 

aside
Does anybody remember key to tape systems other than Mohawk?
/aside

 programmers writing business apps needed a way to convert dates as
 strings to numbers that was easy and fit in small memory).

 Assuming I'm right about that, then the use of a leading 0 to
 represent octal actually predates the prevalence of using 0 in dates
 by almost two decades. 

Not quite - at the time I started, punch cards and data entry forms were 
already well established practice, and at least on the English machines, (ICL 
1500/1900 series) octal was prevalent, but I don't know when the leading zero 
octal notation started, and where.  I only met it much later in life, and 
learned it through hard won irritation, because it is a stupid convention, 
when viewed dispassionately.

 And while using leading zeros in other 
 contexts is familiar to me, I would certainly not consider it
 common by any means.  Thus I think it's fair to say that when this
 syntax was selected, it was a rather good choice.

I think you give it credence for far more depth of design thinking than what 
actually happened in those days - some team working on a compiler made a 
decision  (based on gut feel or experience, or precedent, or whim ) and that 
was that - lo! - a standard is born! -- We have always done it this way, here 
at company  x.  And besides, we cannot ask our main guru to spend any of his 
precious time mucking around with trivia - the man may leave us for the 
opposition if we irritate him, and systems people do not grow on trees, you 
know.

- Hendrik

-- 
http://mail.python.org/mailman/listinfo/python-list


WEB PROGRAMMER ANALYST (with Python knowledge) for Laval, Quebec needed.

2009-08-30 Thread Marc-André Ouellette
To whom it may concern,

 

ABP Personnel Consultants is a recruiting firm established in Montreal.  We
presently have a need for a web programmer with knowledge of Python.  Below
is the job description :

 

Our client offers much more than simple Internet advertising and website
design. They are a full-service automotive industry consulting company that
develops integrated sales and CRM solutions, focussing on showing clients
how to make the most of online communications.  Their digital marketing
services are geared towards measurable results attained with the help of
rigorous online methodology.

 

Du to the expansion of the company nationally, they are seeking talented
individuals to fill full-time software development positions at their
offices in Laval.
The candidate will be responsible for analyzing client requests and/or
specifications. Determine the functionality demanded by the system and
resources/requirements, using the most
appropriate development technology to produce the required application,
and/or modification.


Additionally, the candidate will work with Quality Assurance department to
validate newly developed applications, and/or modifications. Software
Developers will also be required to troubleshoot applications when problems
arise.

The working environment is flexible, easy going and encourages teamwork.   

 

EXPERIENCE (not required to know all):


Candidates should have commercial programming experience (Python, SQL and
Javascript).
Knowledge in one or more of the following technologies is desirable:
Languages: Python, SQL, JavaScript, C/C++, Delphi
Servers: Apache, Sybase, PostgreSQL
Markups: HTML, XML, CSS, XUL
Frameworks/Toolkits: Django, Twisted Matrix, wxWidgets
Protocols: TCP/UDP IP, XMLRPC/SOAP, AJAX, FTP, HTTP, POP/SMTP
OSes: Linux, Windows, MacOSX
Other: Client/server architectures, version control systems Mercurial

 

SALARY:

 

Based on level of experience, from 5$ to 75000$ + benefits.

 

 

If your interested to know more, please contact me. 

 

Regards,

 

Marc-André Ouellette

marcan...@abppers.com

 

 

Marc-André Ouellette

Consultant en recrutement

Recruitment consultant

T. 514-939-3399 poste 105

F. 514-939-0241

Courriel : marcan...@abppers.com



Consultez nos offres d'emplois au www.abppers.com 

Visit us online at  http://www.abppers.com/ www.abppers.com 

 Ce message, ainsi que tout fichier qui y est joint, est destiné
exclusivement aux personnes à qui il est adressé. Il peut contenir des
renseignements ou des informations de nature confidentielle qui ne doivent
être divulgués en vertu des lois applicables. Si vous n'êtes pas le
destinataire de ce message ou un mandataire autorisé de celui-ci, par la
présente vous êtes avisé que toute impression, diffusion, distribution ou
reproduction de ce message et de tout fichier qui y est joint est
strictement interdite. L'intégrité de ce message n'étant pas assurée sur
Internet, ABP Consultants en Personnel inc. ne peut être tenue responsable
de son contenu s'il a été altéré, déformé ou falsifié. Si ce message vous a
été transmis par erreur, veuillez en aviser sans délai l'expéditeur et
l'effacer ainsi que tout fichier joint sans en conserver de copie.

This message, and any attachments, is intended only for the use of the
addressee or his authorized representative. It may contain information that
is privileged, confidential and exempt from disclosure under applicable law.
If the reader of this message is not the intended recipient,or his
authorized representative, you are hereby notified that any dissemination,
distribution or copying of this message and any attachments isstrictly
prohibited. The integrity of this message cannot be guaranteed on the
Internet, ABP Personnel Consultants inc. shall not be liable for its content
if altered, changed or falsified. If you have received this message in
error, please contact right away with the sender and delete this message
andany attachments from your system.

 

 

image001.jpg-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Overriding iadd for dictionary like objects

2009-08-30 Thread Jan Kaliszewski

PS. Sorry for sending 2 posts -- the latter is the correct one.

Cheers,
*j
--
http://mail.python.org/mailman/listinfo/python-list


Suggestion

2009-08-30 Thread Thangappan.M
Dear all,

 I am in the process of learning Python programming language. I know
Perl,PHP. Compare to both the language Python impressed me because here
there is no lexical variables and all.Now I need suggestion saying that ,
What online book can I follow?

 I have not yet learnt any advanced programming stuffs in Python.
Please suggest some book? or tutorial. net net my goal is that I will be
able to do the project in any languages(Python,Perl,PHP).So I need to learn
more depth knowledge of Python.

So Please help me?



-- 
Regards,
Thangappan.M
-- 
http://mail.python.org/mailman/listinfo/python-list


a popen command line question

2009-08-30 Thread Joni Lee
Hi all,

I write a small script

status = os.popen('top').readlines()
print status

It calls the command line top and will print out the status.
But I have to press the keyboard q to quit top, then the status will be 
printed, otherwise it just stands by with blank.

Question is. Do you know how to give q into my python script so that top is 
automatically quit immediately or maybe after 1s (for gathering information)

Sorry the question is weird.



  -- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why does this group have so much spam?

2009-08-30 Thread Miles Kaufmann

casebash walkr...@gmail.com wrote in message
news:7294bf8b-9819-4b6d-92b2- 
afc1c8042...@x6g2000prc.googlegroups.com...

So much of it could be removed even by simple keyword filtering.


Funny, I was just thinking recently about how *little* spam this list  
gets--on the other hand, I'm following it via the python-list@ mailing  
list.  The list owners do a great job of keeping the level of spam at  
a minimum, though there are occasional false positives (like your  
post, apparently, since I'm only seeing the replies).


-Miles

--
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread Jan Kaliszewski

30-08-2009 o 14:11:15 Hendrik van Rooyen hend...@microcorp.co.za wrote:

a nightmare of Orwellian proportions - because the language you get  
taught first, moulds the way you think.  And I know from personal  
experience that

there are concepts that can be succinctly expressed in one language, that
takes a lot of wordy handwaving to get across in another.  So diversity  
would be less, creativity would suffer due to lack of cross pollination,

and progress would slow or stop.


That's the point! Even in the case of programming languages we say about
'culture' and 'way of thinking' connected with each of them, though
after all they are only formal constructs.

In case of natural languages it's incomparably richer and more complex.
Each natural language has richness of culture and ages of history
-- behind that language and recorded in it in many ways.

Most probably such an unification would mean terrible impoverishment
of our (humans') culture and, as a result, terrible squandering of our
intelectual, emotional, cognitive etc. potential -- especially if such
unification were a result of intentional policy (and not of a slow and
'patient' process of synthesis).

*j

--
Jan Kaliszewski (zuo) z...@chopin.edu.pl
--
http://mail.python.org/mailman/listinfo/python-list


Python/Fortran interoperability

2009-08-30 Thread nmm1

I am interested in surveying people who want to interoperate between
Fortran and Python to find out what they would like to be able to do
more conveniently, especially with regard to types not supported for C
interoperability by the current Fortran standard.  Any suggestions as to
other ways that I could survey such people (Usenet is no longer as
ubiquitous as it used to be) would be welcomed.

My Email address is real, so direct messages will be received.

Specifically, I should like to know the answers to the following
questions:

1) Do you want to use character strings of arbitrary length?

2) Do you want to use Python classes with list members, where the
length of the list is not necessarily fixed for all instances of the
class?  Or, equivalently, Fortran derived types containing allocatable
or pointer arrays?

2) Do you want to use Fortran derived types or Python classes that
contain type-bound procedures (including finalizers)?  Please answer
yes whether or nor you would like to call those type-bound procedures
from the other language.

4) Do you want to call functions where the called language allocates
or deallocates arrays/lists/strings for use by the calling language?
Note that this is specifically Fortran-Python and Python-Fortran.


Regards,
Nick Maclaren.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of Tkinter and IDLE

2009-08-30 Thread r
Thanks eb303 for the wonderful post

I have looked over the new ttk widgets and everything looks nice. I am
very glad to see the death of Tix as i never much liked it anyhow and
always believed these widgets should have been in the main Tkinter
module to start with. The tree widget has been needed for some time.

However, i am not sure about the new style separation. Previously a
simple command like root.option_add('*Label.Font'...) accomplished the
same thing with less typing, but there may be a future method to this
current madness that i am unaware of...???
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread r
On Aug 29, 7:22 pm, Neil Hodgson nyamatongwe+thun...@gmail.com
wrote:

    Wow, I like this world you live in: all that altruism!

Well if i don't who will? *shrugs*

 Unicode was
 developed by corporations from the US left coast in order to sell their
 products in foreign markets at minimal cost.

So why the heck are we supporting such capitalistic implementations as
Unicode. Sure we must support a winders installer but Unicode, dump
it! We don't support a Python group in Chinese or French, so why this?
Makes no sense to me really. Let M$ deal with it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread John Machin
On Aug 30, 4:47 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote:
 On Sun, 30 Aug 2009 14:05:24 +1000, Anny Mous b1540...@tyldd.com
 declaimed the following in gmane.comp.python.general:

  Have you thought about the difference between China, with one culture and
  one spoken language for thousands of years, and Europe, with dozens of

         China has one WRITTEN language -- It has multiple SPOKEN languages

... hence Chinese movies have subtitles in Chinese. And it can't
really be called one written language. For a start there are the
Traditional characters and the Simplified characters. Then there are
regional variations and add-ons e.g. the Hong Kong Special Character
Set (now added into Unicode): not academic-only stuff, includes
surnames, the Hang in Hang Seng Index and Hang Seng Bank, and the
5th character of the Chinese name of The Hongkong and Shanghai Banking
Corporation Limited on the banknotes it issues.

 (the main two being mandarin and cantonese -- with enough differences
 between them that they might as well be spanish vs italian)

Mandarin and Cantonese are groups of languages/dialects. Rough figures
(millions): Mandarin 850, Wu 90, Min and Cantonese about 70 each. The
intelligibility comparison is more like Romanian vs Portuguese, or
Icelandic vs Dutch. I've heard that the PLA used Shanghainese (Wu
group) as code talkers just like the USMC used Navajos.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread r
On Aug 30, 7:11 am, Hendrik van Rooyen hend...@microcorp.co.za
wrote:
(snip)
 I suspect that the alphabet is not ideal for representing the sounds of _any_
 language, and I would look for my proof in the plethora of things that we use
 when writing, other than the bare A-Z.   - Punctuation, diacritics...

It can be made better and if that means add/removing letters or
redefining what a letter represents i am fine with that. I know first
hand the hypocrisy of the English language. I am thinking more on the
lines of English redux!

 Not that I agree that it would be a Utopia, whatever the language  - more like
 a nightmare of Orwellian proportions - because the language you get taught
 first, moulds the way you think.  And I know from personal experience that
 there are concepts that can be succinctly expressed in one language, that
 takes a lot of wordy handwaving to get across in another.  So diversity would
 be less, creativity would suffer due to lack of cross pollination, and
 progress would slow or stop.

We already live in a Orwellian language nightmare. Have you seen much
change to the English language in your lifetime? i haven't. A language
must constantly evolve and trim the excess cruft that pollutes it. And
English has a mountain of cruft! After all our years on this planet i
think it's high time to perfect a simplified language for world-wide
usage.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread r
On Aug 30, 10:09 am, Paul Boddie p...@boddie.org.uk wrote:
 On 30 Aug, 14:49, r rt8...@gmail.com wrote:

Then you aren't paying attention.
...(snip: defamation of character)

Hold the phone Paul you are calling me a retarded bigot and i don't
much appreciate that. I think you are completely misinterpreting my
post. i and i ask you read it again especially this part...

[quote]
BUT STOP!, before i go any further i want to respond to what i know
will be condemnation from the sociology nuts out there. Yes
multiculturalism is great, yes art is great, but if you can't see how
the ability to communicate is severely damperd by multi-languages
then
you only *feel* with your heart but you apparently have no ability to
reason with your mind intelligently.
[/quote]

I don't really care what language we adopt as long as we choose *only*
one and then seek to perfect it to perfection. And also that this
*one* language use simplicity as it's model. English sucks, but
compared to traditional Chinese and Egyptian Hieroglyphs it's a god
send.

I think a good language would combine the best of the popular world
languages into one super language for all. The same thing Python did
for programming. But of course programming is not as evolved as
natural language so we will need multiple programming languages for
quite some time...

And just as the internet enabled worldwide instant communication, the
unification of all languages will cause a Renaissance of sorts for
coloaboration which in turn will beget innovation of enormous
proportions. The ability to communicate unhampered is in everyones
best interest.

---
History Lesson and the laws of Nature
---
Look history is great but i am more concerned with the future. Learn
the lessons of the past, move on, and live for the future. If you want
to study the hair styles of Neanderthal women be my guest. Anybody
with half a brain knows the one world government and language is
coming. Why stop evolution, it is our destiny and it will improve the
human experience.

[Warning: facts of life ahead!!]
I'll bet you weep and moan for the native Americans who where
slaughtered don't you? Yes they suffered a tragic death as have many
poor souls throughout history and yes they also contributed to human
history and experience, but their time had come and they can only
blame themselfs for it. They stopped evolving, and when you stop
evolving you get left behind. We can't win wars with bows and arrows
in the 21st century, we can't fly to the moon on horse back, And you
damn sure can smoke a peace pipe and make all the bad things
disappear.

Nature can be cruel and unjust at times, but progress is absolute and
that is all mother nature (and myself to some extent) really cares
about. Without the survival of the fittest nothing you see, feel,
touch, or experience would be. The universe would collapse upon itself
and cease to exist. The system works because it is perfect. Don't
knock that which you do not understand, or, you refuse to understand..

We are but pawns in an ever evolving higher order entity. And when
this entity no longer has a use for us, we will be history...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An assessment of the Unicode standard

2009-08-30 Thread r
Would someone please point me to one example where this sociology or
anthropology crap has ever improved our day to day lives or moved use
into the future with great innovation? A life spend studying this
mumbo-jumbo is a complete waste of time when many other far more
important and *real* problems need solving!

To me this is nothing more than educated people going antiquing on a
Saturday afternoon! All they are going to find is more useless,
overpriced junk that clogs up the closets of society!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Does Class implements Interface?

2009-08-30 Thread Emanuele D'Arrigo
Jonathan, Stephen and Max, thank you all for the tips and tricks. Much
appreciated.

Manu
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do I insert a menu item in an existing menu.

2009-08-30 Thread John Ladasky
You might want to direct your wxPython questions to the dedicated
wxPython newsgroup.  It's Google-only, and thus not part of the Usenet
hierarchy.  But it's the most on-topic newsgroup you will find.

http://groups.google.com/group/wxpython-users

I attempted to crosspost this article to wx-python users, but that
doesn't work for non-Usenet groups... Good luck!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Learning Python advanced features

2009-08-30 Thread Michel Claveau - MVP
Bonsoir ! 

Tu aurais peut-être dû répondre en anglais (pour certains, advanced features, 
c'est mieux que concepts sophistiqués).

@+

MCI
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Move dictionary from instance to class level

2009-08-30 Thread Frank Millman

Frank Millman fr...@chagford.com wrote:

Apologies for the triple-post.

I use google-groups for reading c.l.py, but I know that some people reject 
messages from there due to the volume of spam, so on the odd occasion when I 
want to send something I fire up Outlook Express and send it from there. It 
seems to be misbehaving today.

Sorry about that.

Frank


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Move dictionary from instance to class level

2009-08-30 Thread Frank Millman

Anthony Tolle wrote:
 To take things one step further, I would recommend using decorators to
 allow symbolic association of functions with the message identifiers,
 as follows:


[...]

That's neat. Thanks.

Frank


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-30 Thread Mensanator
On Aug 26, 4:59 pm, Piet van Oostrum p...@cs.uu.nl wrote:
  Mensanator mensana...@aol.com (M) wrote:
 M That's my point. Since the common usage of binary is for
 M Standard Positional Number System of Radix 2, it follows
 M that unary is the common usage for Standard Positional
 M Number System of Radix 1. That's VERY confusing since such
 M a system is undefined. Remember, common usage does not
 M necessarily properly define things. Saying simply unary
 M sounds like you're extending common usage beyond its proper
 M boundaries.

 But the customary meaning of `unary' is the tally system, as a radix
 system wouldn't make sense. I don't know when this term came into use
 but I have known it for a long time.

Ok, I'll accept that and in the same breath say such common usage
is stupid. I, for one, have never heard such usage and would never
use unary in the same breath as decimal, octal, binary even if
I had.

 --
 Piet van Oostrum p...@cs.uu.nl
 URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4]
 Private email: p...@vanoostrum.org

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-30 Thread Steven D'Aprano
On Thu, 27 Aug 2009 10:49:27 -0700, Mensanator wrote:

 Fine. I'm over it. Point is, I HAVE encountered plenty of people who
 DON'T properly understand it, Marilyn Vos Savant, for example. 

I'm curious -- please explain. Links please?


 You can't
 blame me for thinking you don't understand it either when unary is
 brought up in a discussion of how to interpret insignificant leading
 0's.

Er, when I show an example of what I'm calling unary, and then later on 
explain in detail and link to a detailed discussion of it, who exactly 
should I blame for your confusion?



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-30 Thread Piet van Oostrum
 Mensanator mensana...@aol.com (M) wrote:

M That's my point. Since the common usage of binary is for
M Standard Positional Number System of Radix 2, it follows
M that unary is the common usage for Standard Positional
M Number System of Radix 1. That's VERY confusing since such
M a system is undefined. Remember, common usage does not
M necessarily properly define things. Saying simply unary
M sounds like you're extending common usage beyond its proper
M boundaries.

But the customary meaning of `unary' is the tally system, as a radix
system wouldn't make sense. I don't know when this term came into use
but I have known it for a long time. 
-- 
Piet van Oostrum p...@cs.uu.nl
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: p...@vanoostrum.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-30 Thread Mel
Mensanator wrote:
[ ... ]
 If you want your data file to have values entered in hex, or oct, or even
 unary (1=one, 11=two, 111=three, =four...) you can.
 
 Unary? I think you'll find that Standard Positional Number
 Systems are not defined for radix 1.

It has to be tweaked.  If the only digit you have is 0 then your numbers 
take the form

0*1 + 0*1**2 + 0*1**3 ...

and every number has an infinitely long representation.  If you cheat and 
take a 1 digit instead then it becomes workable.

Mel.



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python/Fortran interoperability

2009-08-30 Thread nmm1
In article 1032c78d-d4dd-41c0-a877-b85ca000d...@g31g2000yqc.googlegroups.com,
sturlamolden  sturlamol...@yahoo.no wrote:
On 23 Aug, 12:35, n...@cam.ac.uk wrote:

 I am interested in surveying people who want to interoperate between
 Fortran and Python to find out what they would like to be able to do
 more conveniently, especially with regard to types not supported for C
 interoperability by the current Fortran standard. =A0Any suggestions as t=
o
 other ways that I could survey such people (Usenet is no longer as
 ubiquitous as it used to be) would be welcomed.

I think you will find that 99.9% of Python and Fortran programmers are
scientists and engineers that also use NumPy and f2py. Go to scipy.org
and ask your question on the numpy mailing list.

Regards,
Sturla Molden





Thanks.  I had forgotten they had a mailing list.

Nick.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python/Fortran interoperability

2009-08-30 Thread Richard Maine
sturlamolden sturlamol...@yahoo.no wrote:

 On 23 Aug, 20:42, n...@cam.ac.uk wrote:
 
  That is precisely what I am investigating.  TR 29113 falls a LONG
  way before it gets to any of the OOP data - indeed, you can't even
  pass OOP derived types as pure data (without even the functionality)
  in its model.  Nor most of what else Python would expect.
 
 I am note sure what you mean. ...
 You thus can pass derived types between C and Fortran.

You missed the word OOP, which seemed like the whole point. Not that
the particular word is used in the Fortran standard, but it isn't hard
to guess that he means a derived type that uses some of the OOP
features. Inheritance, polymorphism, and type-bound procedure (aka
methods in some other languages) come to mind. Since you say that you
haven't used any of the F2003 OOP features, it isn't too surprising that
you'd miss the allusion.

-- 
Richard Maine| Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle   |  -- Mark Twain
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python/Fortran interoperability

2009-08-30 Thread nmm1
In article e0a956ea-ab2a-4651-809d-ee76b11a6...@b15g2000yqd.googlegroups.com,
sturlamolden  sturlamol...@yahoo.no wrote:

You also made this claim regarding Fortran's C interop with strings:

No, I mean things like 'Kilroy was here'.  Currently, Fortran's C
interoperability supports only strings of length 1, and you have
to kludge them up as arrays.  That doesn't work very well, especially
for things like function results.

This obviosuly proves you wrong:

Er, no, it doesn't.  I suggest that you read what I said more
carefully - and the Fortran standard.  As I said, you can kludge
them up, and that is precisely one such kludge - but, as I also
said, it doesn't work very well.

However, I shall take your answer as a yes, I want to do that.



Regards,
Nick Maclaren.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sending email

2009-08-30 Thread 7stud
On Aug 28, 8:18 am, Fencer no.i.d...@want.mail.from.spammers.com
wrote:
 7stud wrote:

 [snip]

 Thanks for your reply. After consulting the sysadmins here I was able to
 get it to work.

 - Fencer


Ok, but how about posting your code so that a future searcher will not
be left screaming, WHAT THE EFF WAS THE SOLUTION!!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Services examples using raw xml?

2009-08-30 Thread John Gordon
In 4a92ee38$0$1627$742ec...@news.sonic.net John Nagle na...@animats.com 
writes:

 John Gordon wrote:
  I'm developing a program that will use web services, which I have never
  used before.

 Web services in general, or some Microsoft interface?

Microsoft.  Exchange Web Services, specifically.

-- 
John Gordon   A is for Amy, who fell down the stairs
gor...@panix.com  B is for Basil, assaulted by bears
-- Edward Gorey, The Gashlycrumb Tinies

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why does this group have so much spam?

2009-08-30 Thread David
Il Sat, 29 Aug 2009 17:18:46 -0700 (PDT), casebash ha scritto:

 So much of it could be removed even by simple keyword filtering.

I think there is only one final solution to the spam pestilence: a tiny tax
on email and posts.
Spammers send hundreds of thousands of emails/posts a day and a tax of
0.0001$ each does not harm normal users but discurages spammers. This tax
should be applied when a message is routed by a ISP server, this saves
mails/posts internal to a LAN.
Direct costs of this tax would be compensated by the simplified management
of network traffic (70-90% of mail traffic is spam) and the reduced risk of
virus infections.

David
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why does this group have so much spam?

2009-08-30 Thread Nobody
On Sun, 30 Aug 2009 11:18:35 +0200, David wrote:

 So much of it could be removed even by simple keyword filtering.
 
 I think there is only one final solution to the spam pestilence: a tiny tax
 on email and posts.
 Spammers send hundreds of thousands of emails/posts a day and a tax of
 0.0001$ each does not harm normal users but discurages spammers.

Apart from the impossibility of implementing such a tax, it isn't going to
discourage spammers when the tax will be paid by the owner of the
compromised PC from which they're sending their spam.

If you want to avoid usenet spam and don't want to filter it yourself,
find a provider with more aggressive spam filter. Ultimately, it's up to
the person running the news server as to which posts they will or will not
accept.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: mod_python: Permission denied

2009-08-30 Thread David
Thanks Graham. Let me contact Admin.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: your favorite debugging tool?

2009-08-30 Thread Ben Finney
Hendrik van Rooyen hend...@microcorp.co.za writes:

 And the final arbiter is of course the interactive prompt.

Oh yes, of course I forget to mention that!

Write your code so it can be imported, and write your functionality so
it has narrow interfaces, and you can do whatever inspection is needed
from the interactive prompt.

-- 
 \“We have to go forth and crush every world view that doesn't |
  `\believe in tolerance and free speech.” —David Brin |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   >