Re: Overriding iadd for dictionary like objects

2009-08-30 Thread RunThePun
On Aug 30, 10:33 pm, a...@pythoncraft.com (Aahz) wrote:
> In article 
> ,
>
>
>
>
>
> RunThePun   wrote:
>
> >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 =3D FilesDict('spam')
>  d['temp.txt'] =3D 'abc'
>  print(d['swallow'])
>
> >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.
>
> You can do mostly what you want, I think, by having __setitem__()
> convert string values into FileProxy() objects that have an appropriate
> __iadd__() method.  That brings a whole new set of problems, of course.
> --
> Aahz (a...@pythoncraft.com)           <*>        http://www.pythoncraft.com/
>
> "I support family values -- Addams family values" --www.nancybuttons.com

I'm guessing you meant __getitem__, which is what Jan Kaliszewski
suggested, but as you noted, would be a bit cumbersome in this case.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why python got less developers ?

2009-08-30 Thread Erik Reppen
It seems to be a language embraced by people who enjoy coding. Not so
much by the time-spent-seeking-degree to paycheck ratio balancing
crowd. Or maybe I just hate bloated IDEs and I've heard too many Java
dev jokes to be impartial.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: map

2009-08-30 Thread Wolfgang Strobl
elsa :

>now, say I want to map myFunc onto myList, with always the same
>argument for b, but iterating over a:

>>> from functools import partial
>>> def g(x,y=1): return x+y
...
>>> map(partial(g,y=2),[1,2])
[3, 4]
>>> map(partial(g,y=42),[1,2])
[43, 44]


-- 
Wir danken für die Beachtung aller Sicherheitsbestimmungen
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: connect to ms sql server with odbc

2009-08-30 Thread Sean DiZazzo
On Aug 30, 10:08 pm, mierdatutis mi  wrote:
> Hi,
>
> I'm newbie in python. I try to connect to remote server with ms sql
> server from my ubuntu. I install pyodbc and I do:
>
>  >>> conn = >>> Conn =
>  pyodbc.connect("DRIVER=
> {FreeTDS};SERVER=defekas62;UID=emuser;PWD=temporal;DATABASE=em620")
> pyodbc.connect ( "DRIVER = () FreeTDS; SERVER = defekas62; UID =
> emuser; PWD = temporal; em620 DATABASE =")
>  cursor = conn.cursor() cursor = conn.cursor ()
>  >>> for row in cursor.execute("select USERNAME from JOBACTIONS"): >>>
> Para la fila en cursor.execute ( "usuario seleccionar de
> JOBACTIONS"):
>  ... ... print row.USERNAME row.USERNAME de impresión
>    File "", line 2 Archivo "", línea 2
>      print row.USERNAME row.USERNAME de impresión
>          ^ ^
>  IndentationError: expected an indented block
> Why this error?
> Many thanks and sorry for my english

Welcome to python.  The error is telling you exactly what it says.
There is a block of code that is not indented properly.  Perhaps your
code was edited with two different editors?

Tabs are not equal to spaces.  Go thru your code and be sure that you
are consistent with all of your spacing.  I believe 4 spaces per
indent (without tabs) is the current Python standard.

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


Re: map

2009-08-30 Thread rurpy
On 08/30/2009 10:55 PM, elsa wrote:
> i have a question about the built in map function. Here 'tis:
>
> say I have a list, myList. Now say I have a function with more than
> one argument:
>
> myFunc(a, b='None')
>
> now, say I want to map myFunc onto myList, with always the same
> argument for b, but iterating over a:
>
> map(myFunc(b='booHoo'), myList)
>
> Why doesn't this work? is there a way to make it work?

When you write "map(myFunc(b='booHoo'), myList)", you are telling
Python to call myFunc before the map function is called, because
an argument list, "(b='booHoo')", follows myFunc.  You want
to pass map a function object, not the results of calling a
function object.

A couple ways to do what you want:

  map(lambda a: myFunc(a, b='booHoo'), myList)

The lamba expression creates a new function of one argument
(which is needed by map) that, when executed, will call myFunc
with the two arguments it needs.

You can also just define an ordinary function that does
the same thing as the lambda above:

  def tmpFunc (a)
myFunc (a, b='booHoo')
  ...
  map (tmpFunc, myList)

In the functools module there is a function called "partial"
that does something similar to the lambda above.  I'll leave
it to you you look it up if interested.

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


Re: map

2009-08-30 Thread Chris Rebert
On Sun, Aug 30, 2009 at 9:55 PM, elsa wrote:
> Hi,
>
> i have a question about the built in map function. Here 'tis:
>
> say I have a list, myList. Now say I have a function with more than
> one argument:
>
> myFunc(a, b='None')
>
> now, say I want to map myFunc onto myList, with always the same
> argument for b, but iterating over a:
>
> map(myFunc(b='booHoo'), myList)
>
> Why doesn't this work?

Because myFunc is executed before map() is ever called, and you didn't
specify a value for the `a` parameter, hence you get an error about
not giving a value for `a`.
Another way of saying this: Python uses "eager evaluation"
(http://en.wikipedia.org/wiki/Eager_evaluation) most of the time.

> is there a way to make it work?

Use functools.partial to fill in the `b` parameter:
http://docs.python.org/library/functools.html#functools.partial

#untested example:
from functools import partial
f = partial(myFunc, b='booHoo')
map(f, myList)

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


connect to ms sql server with odbc

2009-08-30 Thread mierdatutis mi
Hi,

I'm newbie in python. I try to connect to remote server with ms sql
server from my ubuntu. I install pyodbc and I do:

 >>> conn = >>> Conn =
 pyodbc.connect("DRIVER=
{FreeTDS};SERVER=defekas62;UID=emuser;PWD=temporal;DATABASE=em620")
pyodbc.connect ( "DRIVER = () FreeTDS; SERVER = defekas62; UID =
emuser; PWD = temporal; em620 DATABASE =")
 cursor = conn.cursor() cursor = conn.cursor ()
 >>> for row in cursor.execute("select USERNAME from JOBACTIONS"): >>>
Para la fila en cursor.execute ( "usuario seleccionar de
JOBACTIONS"):
 ... ... print row.USERNAME row.USERNAME de impresión
   File "", line 2 Archivo "", línea 2
 print row.USERNAME row.USERNAME de impresión
 ^ ^
 IndentationError: expected an indented block
Why this error?
Many thanks and sorry for my english
-- 
http://mail.python.org/mailman/listinfo/python-list


map

2009-08-30 Thread elsa
Hi,

i have a question about the built in map function. Here 'tis:

say I have a list, myList. Now say I have a function with more than
one argument:

myFunc(a, b='None')

now, say I want to map myFunc onto myList, with always the same
argument for b, but iterating over a:

map(myFunc(b='booHoo'), myList)

Why doesn't this work? is there a way to make it work?

(Ultimately, I want to call myFunc(myList[0], 'booHoo'), myFunc(myList
[1], 'booHoo'), myFunc(myList[2], 'booHoo') etc. However, I might want
to call myFunc(myList[0], 'woo'), myFunc(myList[1], 'woo'), myFunc
(myList[2], 'woo') some other time).

Thanks,

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


Re: why python got less developers ?

2009-08-30 Thread r
On Aug 29, 11:14 pm, kennyken747  wrote:
(snip)
> You guys can say anything you'd like it to be in this thread, but the
> actual reason comes down to
> 1. No marketing. Seriously, if Microsoft was pushing Python it would
> obviously be a lot bigger in terms of developers.

I really don't care if 100 or 100 million are using Python as long as
it will endure my lifetime so i can use it ;). But it would be
interesting to see a good approx of this number... just for kicks

> Also, really guys? This crap about speed? People have been saying this
> for years, and yet they still don't realize that there are plenty
> solutions to take care of that one problem.
>
> Just be happy that you've stumbled upon Python, just because it's not
> the most widespread language in the world certainly doesn't mean it's
> not a worthy language. Quite the opposite.

Your post seems a contridiction of itself? i am confused :\

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


Re: What python can NOT do?

2009-08-30 Thread John Nagle

exar...@twistedmatrix.com wrote:

On 10:23 pm, a...@pythoncraft.com wrote:

In article <4a998465$0$1637$742ec...@news.sonic.net>,
John Nagle   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.

...


For my part, I will agree with John.  I feel like Python's big 
shortcomings stem from the areas he mentioned.  They're related to each 
other as well - the lack of a standard hampers the development of a less 
naive interpreter (either one based on CPython or another one).  It 
doesn't completely prevent such development (obviously, as CPython 
continues to undergo development, and there are a number of alternate 
runtimes for Python-like languages), but there's clearly a cost 
associated with the fact that in order to do this development, a lot of 
time has to be spent figuring out what Python *is*.  This is the kind of 
thing that a standard would help with.


   Right.  Python is a moving target for developers of implementations other
than CPython.  IronPython's production version is at Python 2.5, with a
beta at 2.6.  Shed Skin is at 2.x and lacks the manpower to get to 3.x.
Psyco I'm not sure about, but it's 2.x.  PyPy is at Python 2.5, but PyPy
is currently slower than CPython.

   A solid Python 3 standard would give everyone a target to shoot for that
would be good for five years or so.

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


Re: Reading binary files

2009-08-30 Thread Dan Stromberg

David Robinow wrote:

This works for a simple binary file, but the actual file I'm trying to
read is give throwing an error that the file cannot be found. Here is the
name of the my file:
2009.08.02_06.52.00_WA-1_0001_00_0662_0.jstars

Should python have trouble reading this file name or extension?
  

I'm having trouble with the filename:
2009.08.02_06.52.00_WA-1_0001_00_0662_0.jstars

It throws an error with that file name, When I change it to something like
sample.txt it runs, but the data is still garbled. Is there any reason why I
can't use the above file name? If I'm using 'rb' to read the binary file why
is it still garbled?


 I don't think it's garbled. It's a binary file. What do you expect?

It's been over ten years since I've worked with any JSTARS stuff so I
can't give you any details but you almost certainly have some sort of
imagery. The military has a lot of bizarre formats and whoever sent
you the data should have included a data sheet describing the format
(or a pointer to such).  Ideally, you'll also get a pointer to code to
read the thing, but sometimes you just have to bite the bullet and
write a program to process the file.
   (If all else fails, look at a dump of the first 512 bytes or so;
often the image size is included at the beginning; maybe in ASCII, 16
bit ints, 32 bit ints, floating point -- who knows)
There've been times when I had to just display the thing at 512 or
1024 bytes (or ints) per row and try to surmise the info from that.
So, look for the file description.
...
Googling a bit:   I see there's a package at
   http://www.mbari.org/data/mbsystem/index.html
which purports to handle some JSTARS stuff. I've no idea if that will help you.
  
If you don't find anything preexisting for reading JSTARS format, this 
might help:


http://stromberg.dnsalias.org/~strombrg/converting-binary.html

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


Re: why python got less developers ?

2009-08-30 Thread Tim Roberts
Esam Qanadeely  wrote:
>On Aug 28, 8:27 am, Tim Roberts  wrote:
>> Deep_Feelings  wrote:
>>
>> >python got relatively fewer numbers of developers than other high
>> >level languages like .NET , java .. etc  why ?
>>
>> How do you know, and why does it matter?
>>
>> By the way, .NET is not a language.  I assume you meant C#.
>
>you know when you go to forums and compare the number of posts and
>topics ,and you know when you google and compare the number of results
>
>.NET= i meant all .NET languages

That's hardly a fair way to categorize things.  "All .NET languages"
includes C++, C#, Basic, Java (in J#), Ocaml (in F#), and Python.
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Popen question (redundant processes)

2009-08-30 Thread Gabriel Genellina
En Sun, 30 Aug 2009 17:25:40 -0300, Chris Rebert   
escribió:



On Sun, Aug 30, 2009 at 12:33 PM, Sebastian wrote:

Hello World!
This is my first post on the list and I'm hoping it is the right forum  
and

not OT, I've searched
a bit on this, but, none-the-wiser!

My question is on the Popen method, here is my snippet:

p1 = Popen(["cat", "georgi_ddr7_allmag_kcor_in_test.dat"], stdout=PIPE  
)

p2 = Popen(["fit_coeffs"], stdin=p1.stdout, stdout=PIPE)
p3 = Popen(["reconstruct_maggies"], stdin=p2.stdout,stdout=PIPE)
output_maggies_z=p3.communicate()[0]

p1 = Popen(["cat", "georgi_ddr7_allmag_kcor_in_test.dat"], stdout=PIPE  
)

p2 = Popen(["fit_coeffs"], stdin=p1.stdout, stdout=PIPE)
p4 = Popen(["reconstruct_maggies", "--band-shift", "0.1", "--redshift",
"0."], stdin=p2.stdout,stdout=PIPE)
output_maggies_z0=p4.communicate()[0]



That is, p1 and p2 are the same, but p3 and p4 which they are passed  
to, are

different.
Is there a way to pass p1 and p2 to p3 AND p4 simultaneously, so as to  
not

need to
run p1 and p2 twice, as above?
What arguments would I need to achieve this?

NOTE: "georgi_ddr7_allmag_kcor_in_test.dat" is a very large file (~1E6
records)


Send the output of p2 through the unix command "tee"
(http://unixhelp.ed.ac.uk/CGI/man-cgi?tee). Then put the output of tee
into p3 and set p4's input to the file you specified to tee.


In addition to that, you can avoid the cat command (and omit p1  
completely), just pass the georgi file as p2 stdin:

p2 = Popen(["fit_coeffs"], stdin=open("georgi..."), ...

In other words, the original shell commands are:

cat georgi.dat | fit | reconstruct
cat georgi.dat | fit | reconstruct --otherargs

and we suggest doing:

fit < georgi.dat | tee /tmp/foo | reconstruct
reconstruct  --otherargs < /tmp/foo

--
Gabriel Genellina

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


Re: initilize a memory zone in python

2009-08-30 Thread r
On Aug 30, 4:59 pm, Mug  wrote:
(snip)
> is there a fonction like "memset" or "bzero" in python?

Not that i know of ;). Try this link for a coverage of the Python
built-in functions. You cannot write quality Python code without
them.
http://docs.python.org/3.1/library/functions.html

What you refer to as an array is called a list round here, see this
informative read
http://docs.python.org/3.1/library/stdtypes.html#sequence-types-str-bytes-bytearray-list-tuple-range

And be sure to check out list comprehentions too, just icing on the
cake ;)

python 3000 docs
http://docs.python.org/3.1/


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


Re: Nice copy in interactive terminal

2009-08-30 Thread casebash
I managed to get some more answers here:

http://stackoverflow.com/questions/1352886/nice-copying-from-python-interpreter

On Aug 14, 5:05 pm, casebash  wrote:
> I mainly develop on Linux these days, but if I ever end up doing
> anything on windows I'll make sure to look at that.
>
> On Aug 13, 6:56 pm, "Elias Fotinis \(eliasf\)" 
> wrote:
>
> > "casebash" wrote:
> > > I've been wondering for a while if there exists an interactive
> > > terminal which has nice copy feature (ie. I can copy code without
> > > getting the >>> in front of every line).
>
> > It would help if we knew what platform you're interested in -- your
> > User-Agent is G2/1.0, but I don't know what that is.  :o)
>
> > On Windows, PythonWin can copy from the interactive window without the
> > prompts.
>
>

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


Re: initilize a memory zone in python

2009-08-30 Thread Grant Edwards
On 2009-08-31, Grant Edwards  wrote:

> If you want a configuration that's all zeros, why bother
> calling tcgetattr() at all?  Just set the configuration to
> zeros:
>
> term_conf = [0,0,0,0,0,0]

Oops, I forgot about cc.  That should be:

  term_conf = [0,0,0,0,0,0,['\x00']*32]

That's why it's easier to just use pyserial ;)
  
-- 
Grant


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


Re: initilize a memory zone in python

2009-08-30 Thread Grant Edwards
On 2009-08-30, Mug  wrote:

> hello, i'm new in python, i used to program in C, i have a
> small problem, i tryed to do some serial port things

You're probably better off just using pyserial:

  http://pyserial.sourceforge.net/

If you really want to muck about with termios stuff, you can
look at the posix serial module in pyserial to see how it's
done.

> import sys,termios
>
> fd = sys.stdin.fileno()
> term_conf=termios.tcgetattr(fd);
>
> now i want to modify the actuall values in term_conf zone to
> zero

Have you looked at the documentation for termios.tcgettattr()?

It returns a list of integers.  If you want set them to zero,
then just set them to zero.

If you want a configuration that's all zeros, why bother
calling tcgetattr() at all?  Just set the configuration to
zeros:

term_conf = [0,0,0,0,0,0]

-- 
Grant

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


Re: ubuntu dist-packages

2009-08-30 Thread David Lyon
On Thu, 27 Aug 2009 07:05:51 -0700 (PDT), Paul Boddie 
wrote:
> No, it's the problem of the Pythonic packaging brigade that package
> retrieval, building and installing is combined into one unsatisfactory
> whole. 

Brigade? That implies a disciplined and systematic approach..

I would suggest a better term is just guerrilla fighters.

There's no central planning.. no looking out for the greater good..

No sense of future.. forgive my pessimism.. 

> In fact, the distributions have proven themselves
> to be quite competent at managing huge numbers of software packages in
> a semi-automated fashion, so it's baffling that people doing work on
> Pythonic packaging tools wouldn't want to learn as much as they can
> about how those people manage it.

That's a serious and true allegation. I think the answer is that the
people that are running it aren't interested in cleaning things up
for the linux or windows platform.

Consensus seems to be just "remove" anything that relates to windows
or linux as an approach to harmonising it.

I believe that it should be harmonised.


> For me, when making Debian packages, it has become easier to use the
> debhelper stuff to install things like documentation and resources
> than it is to figure out which special options have to be passed to
> the particular distutils incarnation of the setup function in order to
> get such stuff put in the right place, especially since distutils
> probably still employs an ad-hoc 1990s proprietary UNIX "oh just dump
> that stuff in some directory or other and forget about it" mentality.

It doesn't. Actually, it can't even do that very well.

90's which '90s ? 1890's ?

> Really, distutils should be all about *dist*ribution and even then get
> out of the way as much as possible - the hard stuff is extracting the
> appropriate knowledge about the built Python interpreter in order to
> build extensions. 

Exactly.

> Installation should be left to something which has
> an opinion about where things should be placed on a particular system,
> and which has the capability to know how to uninstall stuff - a
> capability which never seems to get any closer in the distutils scene.

(sigh) - it is true...

David

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


Re: Colors on IDLE

2009-08-30 Thread r
On Aug 28, 6:27 pm, r  wrote:
> Have you tried saving the files as MYScriptName.py? notice the py
> extension, very important ;)

Just for fun try the .pyw extension and observe the result.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PyGTK problems after Linux update...

2009-08-30 Thread barcaroller

"Thomas Guettler"  wrote in message
news:7fq56df2m6ql...@mid.individual.net...

> Looks like your pygtk package does not fit to the installed python
> package.

Okay, I won't disagree, but how do I fix this?


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


Re: Combining C and Python programs

2009-08-30 Thread Cousin Stanley


> I want to write a program that will use ode for the physics 
> simulation, whose python bindings are outdated. So I'm writing 
> the physics engine in C and want to write the drawing code in 
> Python. What will be the best way of making those two programs 
> work together? THe physics engine won't have to run concurrently 
> with the drawing code. It will only return some position data so 
> they can be drawn.

  You might find VPython useful  

  http://www.vpython.org/

  A VPython example using ode 

  http://vpython.wikidot.com/forum/t-109218


-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona

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


Re: Why does this group have so much spam?

2009-08-30 Thread Terry Reedy

Nobody wrote:


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.


It would encourge PC owners to not let their machine be used as a spambot.

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


Re: Why does this group have so much spam?

2009-08-30 Thread Terry Reedy

Byung-Hee HWANG wrote:

casebash  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


Or read python-list as a newsgroup via news.gmane.org, which mirrors 
python-list, not c.l.p.



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


Re: quantiles of a student distribution

2009-08-30 Thread Terry Reedy

Pierre wrote:

Hello...

Do you know how I can calculate the quantiles of a student
distribution in pyhton ?


Try searching the net for 'Python student distribution quantiles'

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


Re: initilize a memory zone in python

2009-08-30 Thread Mug
On Aug 30, 8:58 pm, "Diez B. Roggisch"  wrote:
> Mug schrieb:
>
> > hello, i'm new in python, i used to program in C,
> > i have a small problem, i tryed to do some serial port things
> > manipulation
> > with python.
> > i have something like:
>
> > import sys,termios
>
> > fd = sys.stdin.fileno()
> > term_conf=termios.tcgetattr(fd);
>
> > now i want to modify the actuall values in term_conf  zone to zero
> > i don't see how to do it,
> > in C we can do : bzero(&term_conf,sizeof(struct termios));
> > i want to know if it exist a similar function in python, thanks
>
> In python you don't modify memory like that.
>
> For the above function, you pass a value as the one you got to
> tcgetattr, with values modified as you desire them.
i tryed
print term_conf
and i saw that the term_conf is actually represent with an array in
python:

zsh/3 4201 [1] % python test.py
[27906, 5, 1215, 35387, 15, 15, ['\x03', '\x1c', '\x7f', '\x15',
'\x04', '\x00', '\x01', '\xff', '\x11', '\x13', '\x1a', '\xff',
'\x12', '\x0f', '\x17', '\x16', '\xff', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00', '\x00',
'\x00', '\x00', '\x00', '\x00']]

it's a array of 7 elements, with the seventh element it self a array,
so in order to initialize them to zero, there's no other way than
modify them
one by one in a loop? is there a fonction like "memset" or "bzero" in
python?

>
> Diez

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


Re: PyGTK problems after Linux update...

2009-08-30 Thread barcaroller

"Thomas Guettler"  wrote in message 
news:7fq56df2m6ql...@mid.individual.net...

> Looks like your pygtk package does not fit to the installed python 
> package.

Okay, I won't disagree, but I how do if fix this?



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


Re: Sending email

2009-08-30 Thread John Haggerty
I would concur

On Fri, Aug 28, 2009 at 9:49 AM, 7stud  wrote:

> On Aug 28, 8:18 am, Fencer 
> 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
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IDE for python similar to visual basic

2009-08-30 Thread Nobody
On Sun, 30 Aug 2009 10:48:24 -0700, r wrote:

> 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.

The main advantage of a GUI builder is that it helps prevent you from
hard-coding the GUI into the program. You could get the same effect by
coding a UIL/XRC/etc file manually, but a GUI builder tends to force it.

It also allows the GUI to be edited by without requiring any programming
knowledge. This eliminates the need for the GUI designer to be familiar
with the programming language used (or any programming language), and
allows customisation by end users.

Creating a GUI programmatically is almost always the wrong approach. It
tends to be adopted due to a path of least resistance, rather than any
affirmative reason.

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


Re: initilize a memory zone in python

2009-08-30 Thread Diez B. Roggisch

Mug schrieb:

hello, i'm new in python, i used to program in C,
i have a small problem, i tryed to do some serial port things
manipulation
with python.
i have something like:

import sys,termios

fd = sys.stdin.fileno()
term_conf=termios.tcgetattr(fd);

now i want to modify the actuall values in term_conf  zone to zero
i don't see how to do it,
in C we can do : bzero(&term_conf,sizeof(struct termios));
i want to know if it exist a similar function in python, thanks


In python you don't modify memory like that.

For the above function, you pass a value as the one you got to 
tcgetattr, with values modified as you desire them.


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


Re: Is behavior of += intentional for int?

2009-08-30 Thread Carl Banks
On Aug 30, 10:27 am, Derek Martin  wrote:
> 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.

*You* find something unfamiliar, and by your logic that means it's
unintuitive for everyone?

Nice logic there, chief.  Presumptuous much?


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


initilize a memory zone in python

2009-08-30 Thread Mug
hello, i'm new in python, i used to program in C,
i have a small problem, i tryed to do some serial port things
manipulation
with python.
i have something like:

import sys,termios

fd = sys.stdin.fileno()
term_conf=termios.tcgetattr(fd);

now i want to modify the actuall values in term_conf  zone to zero
i don't see how to do it,
in C we can do : bzero(&term_conf,sizeof(struct termios));
i want to know if it exist a similar function in python, thanks
-- 
http://mail.python.org/mailman/listinfo/python-list



Re: Popen question (redundant processes)

2009-08-30 Thread Chris Rebert
On Sun, Aug 30, 2009 at 12:33 PM, Sebastian wrote:
> Hello World!
> This is my first post on the list and I'm hoping it is the right forum and
> not OT, I've searched
> a bit on this, but, none-the-wiser!
>
> My question is on the Popen method, here is my snippet:
>
>> p1 = Popen(["cat", "georgi_ddr7_allmag_kcor_in_test.dat"], stdout=PIPE )
>> p2 = Popen(["fit_coeffs"], stdin=p1.stdout, stdout=PIPE)
>> p3 = Popen(["reconstruct_maggies"], stdin=p2.stdout,stdout=PIPE)
>> output_maggies_z=p3.communicate()[0]
>>
>> p1 = Popen(["cat", "georgi_ddr7_allmag_kcor_in_test.dat"], stdout=PIPE )
>> p2 = Popen(["fit_coeffs"], stdin=p1.stdout, stdout=PIPE)
>> p4 = Popen(["reconstruct_maggies", "--band-shift", "0.1", "--redshift",
>> "0."], stdin=p2.stdout,stdout=PIPE)
>> output_maggies_z0=p4.communicate()[0]
>>
>
> That is, p1 and p2 are the same, but p3 and p4 which they are passed to, are
> different.
> Is there a way to pass p1 and p2 to p3 AND p4 simultaneously, so as to not
> need to
> run p1 and p2 twice, as above?
> What arguments would I need to achieve this?
>
> NOTE: "georgi_ddr7_allmag_kcor_in_test.dat" is a very large file (~1E6
> records)

Send the output of p2 through the unix command "tee"
(http://unixhelp.ed.ac.uk/CGI/man-cgi?tee). Then put the output of tee
into p3 and set p4's input to the file you specified to tee.

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


port of GWT GChart to python pyjamas

2009-08-30 Thread lkcl
the excellent GWT Chart Library, GChart:
http://code.google.com/p/gchart/
is being ported to python, to run under the pyjamas [desktop / web]
widget set:

http://pyjamas.svn.sourceforge.net/viewvc/pyjamas/trunk/library/pyjamas/chart/
approximately 15 of the 30 examples and 1 of the 90 test charts have
been ported already, enough to show that the libray is in a mostly
useable state, even after only three days.  pie-charts are proving
slightly problematic (as GChartExample24, which is a pie chart editor,
shows).

on the TODO list is:
* the rest of the examples and test charts
* GWT's NumberFormat (a basic one is in place right now)
* GWT's DateFormat (a basic one is in place right now)
* a basic implementation of re.py (for use in pyjs)
* a port of http://code.google.com/p/gwt-canvas/ (for GChart
optimisation purposes)

conversion of the examples from java to python is pretty
straightfoward: pyjamas/contrib/java2py.py is a _very_ basic java to
python converter which takes care of the majority of the global/search/
replace tricks, and also it converts all { } matched braces into the
correct python indentation levels.  when using java2py.py, it relies
on well-formatted code (which 99.9% of GWT is, and 99.5% of GChart
is).  code MUST be converted to actually _have_ braces, so a single-
line "if" statement will give a great deal of grief: pre-editing of
the java code is therefore sometimes required.

please note: no real experience of java programming is required to
convert java into python with java2py.py.

if anyone would like to help out with this porting project, feel free
to check out the source code and submit patches to 
http://code.google.com/p/pyjamas/issues
and contact http://groups.google.com/group/pyjamas-dev/


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


Re: Thread Pool

2009-08-30 Thread Stephen Hansen
On Sun, Aug 30, 2009 at 1:06 PM, John Haggerty  wrote:

> twisted? I don't get it
>

Twisted. Big library / framework for network'd applications. Specifically,
asynchronous network'd applications, really.

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


Re: Thread Pool

2009-08-30 Thread John Haggerty
twisted? I don't get it

On Sun, Aug 30, 2009 at 1:55 PM, Stephen Hansen wrote:

>
> On Sun, Aug 30, 2009 at 9:56 AM, Vitaly Babiy  wrote:
>
>> 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
>>
>>
> As obscene as it seems, I actually use twisted's :)
>
> I mean, it's obscene not because it's badly done or anything, but because
> to use twisted to do threads sounds terribly wrong. But I have twisted
> installed anyway for a different purpose, so figured why not. It seems to
> work fine / scale well / clean up fine (assuming my code is correct).
>
> --S
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Thread Pool

2009-08-30 Thread Stephen Hansen
On Sun, Aug 30, 2009 at 9:56 AM, Vitaly Babiy  wrote:

> 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
>
>
As obscene as it seems, I actually use twisted's :)

I mean, it's obscene not because it's badly done or anything, but because to
use twisted to do threads sounds terribly wrong. But I have twisted
installed anyway for a different purpose, so figured why not. It seems to
work fine / scale well / clean up fine (assuming my code is correct).

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


Re: An assessment of the Unicode standard

2009-08-30 Thread Stephen Hansen
>
> 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.
>

Who, exactly, do you think "we" are?

You're off talking about The Python Community again, aren't you. I thought
we talked about that.

"We" are a group of diverse people from diverse backgrounds-- national and
linguistic-- and quite a few who either run our own business or are
connected to businesses. A very huge chunk of folk around here quite like
capitalistic implementations. Python's very business and closed-source
friendly, remember?

This "crusade change the world" crap is so strikingly stupid of a troll
approach for this group, I'm startled that it's worked. But it has, so kudos
to you! Can't you go try to get someone fired up who has some philosophical
basis in the group's existence?

Python's not the FSF*. It's not software-for-freedom to change the world.
It's software to get things done, and keep things done down the road.

... sigh. I fed the troll.

--S

P.S. *And I mean no insult by this towards the FSFL. It's a
political/philosophical for-the-good-of-humanity organization, is all. Good
for them.
-- 
http://mail.python.org/mailman/listinfo/python-list


Popen question (redundant processes)

2009-08-30 Thread Sebastian
Hello World!
This is my first post on the list and I'm hoping it is the right forum and
not OT, I've searched
a bit on this, but, none-the-wiser!

My question is on the Popen method, here is my snippet:

p1 = Popen(["cat", "georgi_ddr7_allmag_kcor_in_test.dat"], stdout=PIPE )
> p2 = Popen(["fit_coeffs"], stdin=p1.stdout, stdout=PIPE)
> p3 = Popen(["reconstruct_maggies"], stdin=p2.stdout,stdout=PIPE)
> output_maggies_z=p3.communicate()[0]
>
> p1 = Popen(["cat", "georgi_ddr7_allmag_kcor_in_test.dat"], stdout=PIPE )
> p2 = Popen(["fit_coeffs"], stdin=p1.stdout, stdout=PIPE)
> p4 = Popen(["reconstruct_maggies", "--band-shift", "0.1", "--redshift",
> "0."], stdin=p2.stdout,stdout=PIPE)
> output_maggies_z0=p4.communicate()[0]
>
>
That is, p1 and p2 are the same, but p3 and p4 which they are passed to, are
different.
Is there a way to pass p1 and p2 to p3 AND p4 simultaneously, so as to not
need to
run p1 and p2 twice, as above?
What arguments would I need to achieve this?

NOTE: "georgi_ddr7_allmag_kcor_in_test.dat" is a very large file (~1E6
records)

regards,
- Sebastian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Overriding iadd for dictionary like objects

2009-08-30 Thread Aahz
In article ,
RunThePun   wrote:
>
>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 =3D FilesDict('spam')
 d['temp.txt'] =3D 'abc'
 print(d['swallow'])
>
>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.

You can do mostly what you want, I think, by having __setitem__()
convert string values into FileProxy() objects that have an appropriate
__iadd__() method.  That brings a whole new set of problems, of course.
-- 
Aahz (a...@pythoncraft.com)   <*> http://www.pythoncraft.com/

"I support family values -- Addams family values" --www.nancybuttons.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Permanently adding to the Python path in Ubuntu

2009-08-30 Thread Chris Colbert
Great! That was the solution I was looking for. Thanks!

Chris

On Sun, Aug 30, 2009 at 12:29 PM, Christian Heimes wrote:
> 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: Is behavior of += intentional for int?

2009-08-30 Thread Steven D'Aprano
On Sun, 30 Aug 2009 12:04:45 -0500, Derek Martin wrote:

> 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.

You're thinking about this too hard and tying yourself in knots trying to 
philosophise about it. In context of OO programming, the distinction 
between objects and values is fuzzy, and it depends on the context: e.g. 
if I have this:

class MyInt(int):
pass

five = MyInt(5)
five.thingy = 23

is thingy part of the value of the object or not?

For most objects, at least for built-ins, the object *is* the value. (For 
custom classes you create yourself, you are free to do anything you 
like.) There's no need to try to distinguish between the object 3 and the 
value of the object 3: you're looking for a distinction that simply 
doesn't matter.


>> 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.

Nonsense on two levels.

Firstly, in Python, *both* 3 and "Hello World" are complex objects, and 
neither are even close to the fundamental bits of data that the hardware 
can deal with.

Secondly, in low level languages, both are nothing but a sequence of 
bytes, and hardware knows how to deal with bytes regardless of whether 
they are interpreted by the human reader as 3 or "Hello World". The 
compiler might stop you from adding 2371 to "Hell" or "o Wor" but the 
hardware would be perfectly happy to do so if asked.



>> 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.

Oh, it's obvious that not everybody gets this behaviour. I understand 
full well that it's different to some other languages, but not all, and 
so some people have their expectations violated.


> 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.

Given Python's programming model and implementation, the behaviour asked 
for *would* lead to the crazy behaviour I described.

(For the record, some early implementations of Fortran allowed the user 
to redefine literals like that, and I'm told that Lisp will do so too.)

So what Zaur presumably saw as a little tiny difference is in fact the 
tip of the iceberg of a fairly major difference. I don't know how smart 
he is, but I'd be willing to bet he hadn't thought through the full 
consequences of the behaviour he'd prefer, given Python's execution 
model. You could make a language that behaved as he wants, and I wouldn't 
be surprised if Java was it, but whatever it is, it isn't Python.


> I find that offensive, 

It's moments like this that I am reminded of a quote from Stephen Fry:

"You're offended? So f***ing what?"

Taking offense at an intellectual disagreement over the consequences of 
changes to a programming model is a good sign that you've got no rational 
argument to make and so have to resort to (real or pretend) outrage to 
win points.


> especially considering that
> Steven's post displayed an overwhelming lack of understanding of what
> the OP was trying to say.

I'm pretty sure I do understand what the OP was trying to say. He 
actually managed to communicate it very well. I think he expects to be 
able to do this:

>>> n = 1
>>> id(n)
123456
>>> n += 1
>>> assert n == 2
>>> id(n)
123456

Do you disagree? What do *you* think he wants?



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


Re: How to install setuptools...egg?

2009-08-30 Thread Rolf

Mike schrieb:

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

Thank you very much. Your recipe did the job.

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


quantiles of a student distribution

2009-08-30 Thread Pierre

Hello...

Do you know how I can calculate the quantiles of a student
distribution in pyhton ?

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


Why does this group have so much spam?

2009-08-30 Thread casebash
So much of it could be removed even by simple keyword filtering.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: your favorite debugging tool?

2009-08-30 Thread Ben Finney
Hendrik van Rooyen  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


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: 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: 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: Web Services examples using "raw" xml?

2009-08-30 Thread John Gordon
In <4a92ee38$0$1627$742ec...@news.sonic.net> John Nagle  
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: Sending email

2009-08-30 Thread 7stud
On Aug 28, 8:18 am, Fencer 
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: Python/Fortran interoperability

2009-08-30 Thread nmm1
In article ,
sturlamolden   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: Python/Fortran interoperability

2009-08-30 Thread Richard Maine
sturlamolden  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 <1032c78d-d4dd-41c0-a877-b85ca000d...@g31g2000yqc.googlegroups.com>,
sturlamolden   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: 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: Numeric literals in other than base 10 - was Annoying octal notation

2009-08-30 Thread Piet van Oostrum
> Mensanator  (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 
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 Mensanator
On Aug 26, 4:59 pm, Piet van Oostrum  wrote:
> > Mensanator  (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 
> URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4]
> Private email: p...@vanoostrum.org

-- 
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: Move dictionary from instance to class level

2009-08-30 Thread Frank Millman

"Frank Millman"  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: 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: 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: 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: 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: An assessment of the Unicode standard

2009-08-30 Thread r
On Aug 30, 10:09 am, Paul Boddie  wrote:
> On 30 Aug, 14:49, r  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
On Aug 30, 7:11 am, Hendrik van Rooyen 
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 John Machin
On Aug 30, 4:47 pm, Dennis Lee Bieber  wrote:
> On Sun, 30 Aug 2009 14:05:24 +1000, Anny Mous 
> 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 29, 7:22 pm, Neil Hodgson 
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 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


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 the Unicode standard

2009-08-30 Thread Jan Kaliszewski

30-08-2009 o 14:11:15 Hendrik van Rooyen  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) 
--
http://mail.python.org/mailman/listinfo/python-list


Re: Why does this group have so much spam?

2009-08-30 Thread Miles Kaufmann

"casebash"  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


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


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


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


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   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.

 

 

<>-- 
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. 


Does anybody remember key to tape systems other than Mohawk?


> 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


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: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: 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: 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


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

2009-08-30 Thread Joshua Judson Rosen
Steven D'Aprano  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: IDE for python similar to visual basic

2009-08-30 Thread r
On Aug 28, 5:19 pm, 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?

Hello qwe 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


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: 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  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: (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 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: 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: Is behavior of += intentional for int?

2009-08-30 Thread Rhodri James

On Sun, 30 Aug 2009 17:37:49 +0100, zaur  wrote:


On 30 авг, 15:49, Carl Banks  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


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: 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


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.  W

Re: Is behavior of += intentional for int?

2009-08-30 Thread zaur
On 30 авг, 15:49, Carl Banks  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: 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: 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: 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 DiZazzo wrote:
> On Aug 29, 5:39 pm, Chris Colbert  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: 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: An assessment of the Unicode standard

2009-08-30 Thread Paul Boddie
On 30 Aug, 14:49, r  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


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: 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 Behnel 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


  1   2   >