Re: What is difference between ADO and RDO

2009-02-06 Thread OdarR
On 6 fév, 10:56, Agile Consulting  wrote:
> Explain ADO and RDO

RU a bot ?

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


Re: What is difference between ADO and RDO

2009-02-06 Thread OdarR
On 6 fév, 19:36, Scott David Daniels  wrote:
> OdarR wrote:
> > On 6 fév, 10:56, Agile Consulting  wrote:
> >> Explain ADO and RDO
>
> > RU a bot ?
>
> I expect someone is experimenting with their spam generator.

An agile one :)

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


flexible find and replace ?

2009-02-16 Thread OdarR
Hi guys,

how would you do a clever find and replace, where the value replacing
the tag
is changing on each occurence ?

"...TAGTAGTAG..TAG."

is replaced by this :

"...REPL01REPL02REPL03..REPL04..."


A better and clever method than this snippet should exist I hope :

counter = 1
while 'TAG' in mystring:
mystring=mystring.replace('TAG', 'REPL'+str(counter), 1)
counter+=1
...

(the find is always re-starting at the string beginning, this is not
efficient.

any ideas ? thanks,

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


Re: flexible find and replace ?

2009-02-18 Thread OdarR
Thanks to everybody.
I need to test your propositions now :)

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


Re: Python Image Library IOError - cannot find JPEG decoder?

2009-02-25 Thread OdarR
On 24 fév, 18:34, Dario Traverso  wrote:
> I've been trying to install the Python Image Library  (PIL) on my Mac  
> OSX Leopard laptop, but have been running into some difficulties.
>
> I've built the library, using the included setup.py  script. The build  
> summary checks out ok, and sounds the option libraries to all be  
> found. I grabbed both libjpeg and freetype2  using  fink.

I did'nt build it, maybe you don't want too.
I used the PIL package for Python 2.5 listed here:
http://pythonmac.org/packages/py25-fat/index.html


hth,
Olivier
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to run python script in emacs

2009-10-07 Thread OdarR
On 26 sep, 17:54, devilkin  wrote:
> I'm just starting learning python, and coding inemacs. I usually
> splitemacswindow into two, coding in one, and run script in the
> other, which is not very convenient. anyone can help me with it? is
> there any tricks likeemacsshort cut?
>
> also please recommand someemacsplug-ins for python programming, i'm
> also beginner inemacs.currently i'm only using python.el. Are any
> plugins supply code folding and autocomplete?
>
> BTW, I'm not a english native speaker, any grammer mistakes, please
> correct them. :)

hello,

I was not so long ago in the same situation.
I switch to emacs too, why ?
probably because the movement is more natural than in vi (used for 12+
years),
python-mode automatically starts on the machines I'm using, this is
very convenient for *re-indentation* .
Python could be difficult to maintain if you don't have a flexible
text editor.
if you want, i can suggest you some lines for the init file .emacs,
in order to keep the text indented with 4 spaces, no tab at all (very
important).

I also suggest you to have a look on ipython shell, which is a super
shell you keep side the text editor.
once you discover it, you'll understand.

I didn't hear for an autocompletion in emacs.
but ipython has a autocompletion. It can sound weird to auto-complete
outside your editor, but I like it.
you can test little code snippets in ipython, discover the
documentation and methods, and try them.
I discover this clever advice in http://oreilly.com/catalog/9780596515829/

currently I work with Mac (Aquamacs), and I was recently on Solaris or
XP as well.
PS: emacs on Mac Terminal with a french keyboard is a bit of a
nightmare considering the META key...:-(
Aquamacs solves this finally.


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


best vi / emacs python features

2009-10-07 Thread OdarR
hello,

* this is not a troll *

which kind of help you have with your favorite editor ?

personnally, I find emacs very nice, in the current state of my
knowledge, when I need to reindent the code.
you know how this is critical in python...:-)

I don't use other python-mode features for the moment, maybe you have
some advices.
I used with success an Xemacs on Solaris, as well as a Aquamacs on
Mac.

For the vi/vim guys, explain us the best features this editor give you
in your py files !

thanks,

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


Re: best vi / emacs python features

2009-10-07 Thread OdarR
On 7 oct, 18:44, Jean-Michel Pichavant  wrote:
> Being a vi fan, I can just tell you that emacs is for loosers, and no
> one will dare to challenge this.

vi is very good for newbees, I recommend it.

> vi/emacs is like choosing between the Celtics or the Lakers, there is no
> reason for that, the fun part resides in being totally devoted to your
> choice :o)
> For my part I never switched to emacs cause I was tired of getting
> syntax error with ':w' inserted everywhere in my code. Bad habits are
> sticky.

just use the other symetric part of your brain.

> One feature I have that emacs don't is that I'm able to efficiently edit
> a file on a remote machine with vim on a terminal (without graphical
> interface), and I'm using it. Apart from that, both solutions are

emacs has the same efficiency on a terminal.
or maybe I don't understand your sentence.

> efficient. I would add that inside a company, it is a good idea to use
> the same editor as you can share knowledge, macro, plugins and so on.

I never used macro with vi or emacs.
I shared know-how for vi or emacs.
I worked in companies full of talented people, open to new
technologies, no issues mixing both editors.
and don't speak of UltraEdit yet :)

Apart of trolling which is also an activity I like,
what are the features vim proposes to Python ?

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


Re: best vi / emacs python features

2009-10-07 Thread OdarR
On 7 oct, 19:29, Tim Chase  wrote:
> Perhaps this is a reference to the alt/meta/control/buckey/super
> key-chords that emacs is infamous for using that don't always get
> reliably transmitted by all terminal-emulation programs and
> consoles.  It was one of my nudging factors towards vi (and later
> vim), because I occasionally used some terminal software in which
> alt or shift+control+alt (and other such combinations) weren't
> detected.  Never had that problem with vi/vim.  And when all else
> fails, I can usually fall back to ed in a pinch ;-)
>
> -tkc

yes, this is true that emacs needs ctrl and meta key.
two keys for lots of combinations :-)
Like with vi when I began, I need a cheat list of keystrokes for
emacs.

ctrl is ok. Meta can always be used with ESC.

if you really need to stay on a unknown terminal for some weeks, it is
not complicated to copy/paste your favorite .emacs file (less than 10
lines is for me sufficient). It's just a matter of organization.


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


Re: How to run python script in emacs

2009-10-07 Thread OdarR
On 7 oct, 22:07, "Sells, Fred"  wrote:
> Hitting ctrl-c, twice quickly works for me.
>

?
what do you mean ?

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


Re: Persistent Distributed Objects

2009-10-10 Thread OdarR
On 10 oct, 05:39, "bouncy...@gmail.com"  wrote:
> Sorry about being interpreted as being vague. `et me try to narrow it down. 
> program a creates objects b c d which each need to use 1 disk space 2 ram 3 
> processor time. I would like to create a heckpoint which would save the work 
> of the object to be later used and then delete it from memory [which I assume 
> from reading about them implimented elsewhere is more or less how they work]. 
> The other part would be to assign the objects via a network depending on the 
> number of network machines. I.e. suppose b c and d see machines e f g on a 
> network they can send those machines objects b c and d and have any work 
> saved on the main machine or local ones. What I was wondering is how would I 
> do that in python. The arbitrary part could be no more complicated than a 
> program where b is calculating a list of prime numbers from x to infinity c 
> is just a notepad program and d is a program that prints say the size of the 
> file as youi type it and says " I like writing a poem of [bytes big] while my 
> computer foun ou that [new prime] is the biggest on [machines #] computers.   
>  Rmi supposedly does this for the distribuited part.     Object persistence 
> does this for saving to the best of what I`ve seen nothing distributes and 
> saved at the same time.      Does that help?

hi,

you could imagine architect a system around Pyro and take care of
persistence with simple pickle ?

Olivier

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


Re: Persistent Distributed Objects

2009-10-10 Thread OdarR
On 10 oct, 05:39, "bouncy...@gmail.com"  wrote:
> Sorry about being interpreted as being vague. `et me try to narrow it down. 
> program a creates objects b c d which each need to use 1 disk space 2 ram 3 
> processor time. I would like to create a heckpoint which would save the work 
> of the object to be later used and then delete it from memory [which I assume 
> from reading about them implimented elsewhere is more or less how they work]. 
> The other part would be to assign the objects via a network depending on the 
> number of network machines. I.e. suppose b c and d see machines e f g on a 
> network they can send those machines objects b c and d and have any work 
> saved on the main machine or local ones. What I was wondering is how would I 
> do that in python. The arbitrary part could be no more complicated than a 
> program where b is calculating a list of prime numbers from x to infinity c 
> is just a notepad program and d is a program that prints say the size of the 
> file as youi type it and says " I like writing a poem of [bytes big] while my 
> computer foun ou that [new prime] is the biggest on [machines #] computers.   
>  Rmi supposedly does this for the distribuited part.     Object persistence 
> does this for saving to the best of what I`ve seen nothing distributes and 
> saved at the same time.      Does that help?

Did you have a look on Zope and ZEO ?
It could be interesting.
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ZEO.stx

br,
Olivier
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: use strings to call functions

2010-02-08 Thread OdarR
On 8 fév, 11:57, Klaus Neuner  wrote:
> Hello,
>
> I am writing a program that analyzes files of different formats. I
> would like to use a function for each format. Obviously, functions can
> be mapped to file formats. E.g. like this:
>
> if file.endswith('xyz'):
>     xyz(file)
> elif file.endswith('abc'):
>     abc(file)
>
> ...
>
> Yet, I would prefer to do something of the following kind:
>
> func = file[-3:]
> apply_func(func, file)
>
> Can something of this kind be done in Python?


and with eval(), did you try ?

import sys

def functext():
print "texte"

def funcdoc():
print "doc"

def funcabc():
print "abc"


if __name__ == "__main__":
#replace filename with suitable value
filename = sys.argv[1].split('.')[1]
try:
eval('func' + filename + '()')
except:
print 'error'

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


Re: use strings to call functions

2010-02-08 Thread OdarR
On 8 fév, 22:28, a...@pythoncraft.com (Aahz) wrote:
> In article 
> <0efe23a6-b16d-4f92-8bc0-12d056bf5...@z26g2000yqm.googlegroups.com>,
>
> OdarR   wrote:
>
> >and with eval(), did you try ?
>
> WARNING: eval() is almost always the wrong answer to any question

warning : it works !
another question ?


> --
> Aahz (a...@pythoncraft.com)           <*>        http://www.pythoncraft.com/
>
> import antigravity

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


Re: use strings to call functions

2010-02-08 Thread OdarR
On 9 fév, 02:50, Jean-Michel Pichavant  wrote:
> Aahz wrote:
> > In article 
> > <0efe23a6-b16d-4f92-8bc0-12d056bf5...@z26g2000yqm.googlegroups.com>,
> > OdarR   wrote:
>
> >> and with eval(), did you try ?
>
> > WARNING: eval() is almost always the wrong answer to any question
>
> Some say that eval is evil !
>
> JM

go to hell ;-), it is part of the language, it seems to match the
aforementioned question.

I don't see it as a problem.
Let's wait Klaus opinion.


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


Re: use strings to call functions

2010-02-09 Thread OdarR
On 9 fév, 11:01, Stefan Behnel  wrote:
> Klaus Neuner, 09.02.2010 10:04:
>
> > my program is supposed to parse files that I have created myself and that
> > are on my laptop. It is not supposed to interact with anybody else
> > than me.
>
> Famous last words.
>
> Stefan

I knew it.

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


any news from Python Magazine ?

2010-02-26 Thread OdarR
Seems rather late...:
http://pythonmagazine.com/

"We'll be back, better than ever, on January 26th, 2010. "

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


Re: loop through each line in a text file

2010-02-26 Thread OdarR
On 26 fév, 22:08, qtrimble  wrote:
> I'm a python newbie but I do have some basic scripting experience.  I
> need to take the line starting with "wer" and extract the year and day
> of year from that string.  I want to be able to add the year and day
> of year from the last line having "wer*" to the lines occurring in
> between "wer*" lines.  Python seems suitable to do this and I'm fairly
> certain I can eventually get this to work but I've been hit with a
> very short time frame so I'm looking for any generous help.  The data
> below is just a sample.  There are well over 500,000 lines that need
> processed.
>
> wer1999001
>       31.2234      82.2367
>       37.9535      82.3456
> wer1999002
>       31.2234      82.2367
>       37.9535      82.3456

did you try something as a working basis ?

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


Re: Multi-Threading and KeyboardInterrupt

2009-06-15 Thread OdarR
On 13 juin, 07:25, Mike Kazantsev  wrote:
> There was quite interesting explaination of what happens when you send
> ^C with threads, posted on concurrency-sig list recently:
>
>  http://blip.tv/file/2232410
>  http://www.dabeaz.com/python/GIL.pdf
>
> Can be quite shocking, but my experience w/ threads only confirms that.

Hi there,
please read this package page (in 2.6), this is very interesting.
http://docs.python.org/library/multiprocessing.html

I tested it : it works. Multi-core cpu's are happy :-)

me too,
Olivier
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread OdarR
On 19 juin, 11:52, Jure Erznožnik  wrote:
> See here for 
> introduction:http://groups.google.si/group/comp.lang.python/browse_thread/thread/3...
>
> Digging through my problem, I discovered Python isn't exactly thread
> safe and to solve the issue, there's this Global Interpreter Lock
> (GIL) in place.
> Effectively, this causes the interpreter to utilize one core when
> threading is not used and .95 of a core when threading is utilized.
>
> Is there any work in progess on core Python modules that will
> permanently resolve this issue?
> Is there any other way to work around the issue aside from forking new
> processes or using something else?

hi,

please read this carefully,


there is a solution for Python on multi-core : multiprocessing api.
Really nice.

Keep real threads for common tasks like network stuff for example.

I recently complained too :-)



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


Re: multiprocessing and process run time

2009-06-19 Thread OdarR
On 19 juin, 16:40, Thomas Robitaille 
wrote:
> Hi,
>
> I'm making use of the multiprocessing module, and I was wondering if there
> is an easy way to find out how long a given process has been running for.
> For example, if I do
>
> import multiprocessing as mp
> import time
>
> def time_waster():
>     time.sleep(1000)
>
> p = mp.Process(target=time_waster)
>
> p.start()
>
> Is there a way that I can then find how long p has been running for? I
> figured I can use p.pid to get the PID of the process, but I'm not sure
> where to go from there. Is there an easy way to do this?

Something like :

import multiprocessing as mp
import time

q_out = mp.Queue()

def time_waster(qo):
time.sleep(5)
qo.put('stopped at ' + time.ctime(time.time()))

def main():
p = mp.Process(target=time_waster, args=(q_out,))
print "start at: " + time.ctime(time.time())
p.start()
p.join()
print q_out.get()

if __name__ == "__main__":
main()


The Queue (the one from multiprocessing ! don't mix with the Queue
module) is used as a safe exchange object between the parent and all
the child.

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


Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread OdarR
On 19 juin, 16:16, Martin von Loewis  If you know that your (C) code is thread safe on its own, you can
> release the GIL around long-running algorithms, thus using as many
> CPUs as you have available, in a single process.

what do you mean ?

Cpython can't benefit from multi-core without multiple processes.

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


Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread OdarR
On 19 juin, 19:13, s...@pobox.com wrote:
>     Olivier> what do you mean ?
>
>     Olivier> Cpython can't benefit from multi-core without multiple
>     Olivier> processes.
>
> It can, precisely as Martin indicated.  Only one thread at a time can hold
> the GIL.  That doesn't mean that multiple threads can't execute.  Suppose

I don't say multiple threads can't execute(?).
I say that with the Python library, I don't see (yet) benefit with
multiple threads *on* multiple CPU/core.

Ever seen this recent video/presentation ? :
http://blip.tv/file/2232410
http://www.dabeaz.com/python/GIL.pdf

> you have two threads, one of which winds up executing some bit of C code
> which doesn't mess with the Python run-time at all (say, a matrix multiply).

I don't know how to do that with common Python operations...
Only one thread will be really running at a time in memory (meanwhile
other thread are waiting).
Are you refering to a specialized code ?

> Before launching into the matrix multiply, the extension module releases the
> GIL then performs the multiply.  With the GIL released another thread can
> acquire it.  Once the multiply finishes the first thread needs to reacquire
> the GIL before executing any calls into the Python runtime or returning.

I don't see such improvement in the Python library, or maybe you can
indicate us some meaningfull example...?

I currently only use CPython, with PIL, Reportlab...etc.
I don't see improvement on a Core2duo CPU and Python. How to proceed
(following what you wrote) ?

A contrario, I saw *real* improvement on parallel computing with the
Py 2.6 multiprocessing module.

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


Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread OdarR
On 19 juin, 21:05, Christian Heimes  wrote:
> I've seen a single Python process using the full capacity of up to 8
> CPUs. The application is making heavy use of lxml for large XSL
> transformations, a database adapter and my own image processing library
> based upon FreeImage.

interesting...

> Of course both lxml and my library are written with the GIL in mind.
> They release the GIL around every call to C libraries that don't touch
> Python objects. PIL releases the lock around ops as well (although it
> took me a while to figure it out because PIL uses its own API instead of
> the standard macros). reportlab has some optional C libraries that
> increase the speed, too. Are you using them?

I don't. Or maybe I did, but I have no clue what to test.
Do you have a real example, some code snippet to can prove/show
activity on multiple core ?
I accept your explanation, but I also like experiencing :)

> By the way threads are evil
> (http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf) and
> not *the* answer to concurrency.

I don't see threads as evil from my little experience on the subject,
but we need them.
I'm reading what's happening in the java world too, it can be
interesting.

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


Re: Status of Python threading support (GIL removal)?

2009-06-19 Thread OdarR
On 19 juin, 21:41, Carl Banks  wrote:
> He's saying that if your code involves extensions written in C that
> release the GIL, the C thread can run on a different core than the
> Python-thread at the same time.  The GIL is only required for Python
> code, and C code that uses the Python API.  C code that spends a big
> hunk of time not using any Python API (like, as Skip pointed out, a
> matrix multiply) can release the GIL and the thread can run on a
> different core at the same time.

I understand the idea, even if I don't see any examples in the
standard library.
any examples ?

> (Note: I'm not talking about releasing the GIL for I/O operations,
> it's not the same thing.  I'm talking about the ability to run
> computations on multiple cores at the same time, not to block in 50
> threads at the same time.  Multiple cores aren't going to help that
> much in the latter case.)

yes, I also speak about hard computation that could benefit with
multiple cores.


> I wish Pythonistas would be more willing to acknowledge the (few)
> drawbacks of the language (or implementation, in this case) instead of
> all this rationalization.  It's like people here in Los Angeles who
> complain about overcast days.  What, 330 days of sunshine not enough?
> Jesus.  I wish people would just say, "This is a limitation of
> CPython.  There are reasons why it's there, and it helps some people,
> but unfortunately it has drawbacks for others", instead of the typical
> "all u hav 2 do is rite it in C LOL".

"LOL"
I would like to say such thing about my weather...I live in Europe in
a rainy country.

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


Re: Status of Python threading support (GIL removal)?

2009-06-20 Thread OdarR
On 20 juin, 11:02, Carl Banks  wrote:
> Here's the thing: not everyone complaining about the GIL is trying to
> get the "raw power of their machines."  They just want to take
> advantage of multiple cores so that their Python program runs
> faster.
>
> It would be rude and presumptuous to tell such a person, "Well, GIL
> isn't that big of a deal because if you want speed you can always
> rewrite it in C to take advantage of multiple cores".

merci Carl, you expressed what I would like to tell.

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


Re: Status of Python threading support (GIL removal)?

2009-06-21 Thread OdarR
On 21 juin, 03:27, Jure Erznožnik  wrote:
> Add:
> Carl, Olivier & co. - You guys know exactly what I wanted.
> Others: Going back to C++ isn't what I had in mind when I started
> initial testing for my project.

Do you think multiprocessing can help you seriously ?
Can you benefit from multiple cpu ?

did you try to enhance your code with numpy ?

Olivier
(installed a backported multiprocessing on his 2.5.1 Python, but need
installation of Xcode first)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python needs a tutorial for install and setup on a Mac

2009-06-22 Thread OdarR
On 22 juin, 12:44, Kushal Kumaran 
wrote:
> On Sun, Jun 21, 2009 at 9:04 PM, Vincent Davis 
> wrote:
> > I am running python on a mac and when I was getting going it was difficult
> > to setup information. Specifically how modify bash_profile, how pythonpath
> > works and how to set it up. how to switch between python versions. How/where
> > to install modules if you have multiple installed versions. I am thinking
> > about this from perspective  of a new pythoner (is there a word for a person
> > who programs in python). I think many new pythoners may be like me and don't
> > mess with the underling UNIX on a mac.
> > My question/suggestion is that there be a nice tutorial for this. I am
> > wiling to contribute much but I am still somewhat new to python and may need
> > help with some details. Also where should this be posted, how do I post it.
> > Do other think there is a need? Any willing to help?
> > But of course I may have missed a great tutorial out there if so I think It
> > needs to be easier to findor I need to learn how to look.
>
> Have you seen the page athttp://www.python.org/download/mac/and the
> pages linked from it?

do you think a pythonista can go further than the given example ?
"
>>> 2 + 2
4
"

;-)

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


Re: python needs a tutorial for install and setup on a Mac

2009-06-22 Thread OdarR
On 22 juin, 12:44, Kushal Kumaran
> Have you seen the page athttp://www.python.org/download/mac/and the
> pages linked from it?
>

As a (usefull) add-on : iPython (a must), I found this page a good
help :
http://www.brianberliner.com/2008/04/ipython-on-mac-os-x-105-leopard/

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


Re: looking for a book on python

2009-06-27 Thread OdarR
On 27 juin, 02:48, Randy Foiles  wrote:
> Hello and thank you for taking your time to read this.
>         I was interested in learning about python.  In the long ago past I did
> learn some programing but I have not used any of it for years.  I do
> remember some basics however so the book does not have to be for a total
> beginner.  (C, C++, BASIC, Visual BASIC, Pascal and some ADA)
>         I have been using Linux for a while and overall still don't know much
> about it but I can find my way.  I have my system dual boot with windows
> vista.
>         I do realize that everyone is different but I would like to see some
> suggestions and maybe reasons why you think it is good.  I have looked
> for/searched and found a few different books but as my means are a bit
> limited right now I don't really want to buy several just one or maybe
> two books.
>         Oh and if someone knows a place to find some used books of this sort
> that would be great (ebay I guess :)
> Thanks for your thoughts
> Randy theslayers9   gmail

"Learning Python"
http://oreilly.com/catalog/9780596513986/

new issue soon, covering 2.6 and 3
http://oreilly.com/catalog/9780596158064/?CMP=AFC-ak_book&ATT=Learning+Python%2c+Fourth+Edition%2c

the best book I read concerning Py understanding, well written.

I would start with web content, then later would buy the fourth
edition of "Learning Python".

enjoy,
Olivier
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beginning with Python; the right choice?

2009-06-27 Thread OdarR
On 27 juin, 04:22, "sato.ph...@gmail.com" 
wrote:
> Hi,
>
> As you can imagine, I am new, both to this group and to Python.  I
> have read various posts on the best book to buy or online tutorial to
> read and have started to go through them.  I was wondering, as someone
> with virtually no programming experience (I am a photographer by
> trade), is Python the right language for me to try and learn?
>
> I do vaguely remember learning what I think was BASIC on some old
> Apple's back in elementary school (circa 1992).  Would something like
> that (the name at least makes it SOUND easier) be more feasible?
>
> If I do choose to learn Python, are there any tutorials for the
> absolute beginner.  I do not mean beginner to Python, but rather,
> beginner to programming.  Someone who hasn't a clue what object
> oriented whatcha-ma-whoozit means.  I ask again because I understand
> that content is always evolving and there might be new tutorials out
> there.
>
> Thanks!
>
> -Daniel Sato

hi,

what is for you the purpose of learning programming ?
what do you want to do ?

at first glance, I think Python is a good choice for you, for its
clarity.

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


Re: fork, threads and proper closing

2009-06-28 Thread OdarR
On 28 juin, 23:26, Tomasz Pajor  wrote:
> Hello,
>
> Configuration is as follows.
>
> I have a starter process which creates 3 sub processes (forks) and each
> of this processes creates a number of threads.
> Threads in that processes have semaphore so on KeyboardInterrupt without
> sending a sigterm to the subprocess i'm not able to close threads.
> Is there any work around? Can I somehow run join for the thread on
> keyboard interrupt?

When creating a thread you can add a Queue parameter to communicate
with threads:
http://docs.python.org/library/queue.html
easy and reliable.

give them a "poison pill" in the queue: a recognizable object placed
on the queue that means "when you get this, stop."

better to not rely on keyboard for thread stopping.

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


Re: fork, threads and proper closing

2009-06-29 Thread OdarR
On 29 juin, 14:44, Francesco Bochicchio  wrote:
> On 29 Giu, 07:10, OdarR  wrote:
>
>
>
> > On 28 juin, 23:26, Tomasz Pajor  wrote:
>
> > > Hello,
>
> > > Configuration is as follows.
>
> > > I have a starter process which creates 3 sub processes (forks) and each
> > > of this processes creates a number of threads.
> > > Threads in that processes have semaphore so on KeyboardInterrupt without
> > > sending a sigterm to the subprocess i'm not able to close threads.
> > > Is there any work around? Can I somehow run join for the thread on
> > > keyboard interrupt?
>
> > When creating a thread you can add a Queue parameter to communicate
> > with threads:http://docs.python.org/library/queue.html
> > easy and reliable.
>
> > give them a "poison pill" in the queue: a recognizable object placed
> > on the queue that means "when you get this, stop."
>
> This is the way I usually go, but it has one important limitation: if
> the thread is waiting
> for a blocking I/O operation to complete, like reading from a socket
> with no data or waiting

add a small wait (time.sleep()), and also, I/O function in Python can
often releas the GIL...

> for a locked resource (i.e. semaphore) to be unlocked, it will not
> service the queue and will
> not read the 'quit command' (the poison pill), and therefore will not
> quit until the blocking
> I/O terminates (and it could be never).
>
> ASAIK, there is no way - in python - to solve this.

no easy way, yes...
but I think I gave a good advice to our friend Tomasz :)

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


Re: why python got less developers ?

2009-08-28 Thread OdarR
On 28 août, 02:47, MRAB  wrote:
> Deep_Feelings wrote:
> > python got relatively fewer numbers of developers than other high
> > level languages like .NET , java .. etc  why ?
>
> Fewer needed?

excellent answer. LOL.

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


Re: Unicode questions

2010-10-21 Thread OdarR
On Oct 19, 9:02 pm, Tobiah  wrote:
> I've been reading about the Unicode today.
> I'm only vaguely understanding what it is
> and how it works.
>
...
> Thanks,
>
> Tobiah

Hi,

A good advice,
read this presentation,
http://farmdev.com/talks/unicode/
Explanation and advices for coding.

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