Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Mark Lawrence
On 30/01/2015 06:16, Marko Rauhamaa wrote: Ian Kelly : At least use "except Exception" instead of a bare except. Do you really want things like SystemExit and KeyboardInterrupt to get turned into 0? How about: == try: do_interesting_stuff() exce

testfixtures 4.1.2 Released!

2015-01-30 Thread Chris Withers
Hi All, I'm pleased to announce the release of testfixtures 4.1.2. This is a bugfix release that fixes the following: - Clarify documentation for name parameter to LogCapture. - ShouldRaise now shows different output when two exceptions have the same representation but stiff differ. - Fix

Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Marko Rauhamaa
Mark Lawrence : > On 30/01/2015 06:16, Marko Rauhamaa wrote: >> How about: >> >> == >> try: >> do_interesting_stuff() >> except ValueError: >> try: >> log_it() >> except: >> pass >> raise >> ===

Re: An object is an instance (or not)?

2015-01-30 Thread Gregory Ewing
Steven D'Aprano wrote: Actually, if you look at my example, you will see that it is a method and it does get the self argument. Here is the critical code again: from types import MethodType polly.talk = MethodType( lambda self: print("Polly wants a spam sandwich!"), polly) Doing it by han

Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Ian Kelly
On Thu, Jan 29, 2015 at 11:16 PM, Marko Rauhamaa wrote: > Ian Kelly : > >> At least use "except Exception" instead of a bare except. Do you >> really want things like SystemExit and KeyboardInterrupt to get turned >> into 0? > > How about: > > == > try: > do

Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Ian Kelly
On Fri, Jan 30, 2015 at 2:02 AM, Marko Rauhamaa wrote: > Mark Lawrence : > >> On 30/01/2015 06:16, Marko Rauhamaa wrote: >>> How about: >>> >>> == >>> try: >>> do_interesting_stuff() >>> except ValueError: >>> try: >>> log_it() >

Re: python client call Java server by xmlrpc

2015-01-30 Thread fan . ding1
Thanks dieter, The issue is solved. I use SmartSniff to get the xml message send by java client, and python client, find the difference. Define a new class: class MyData(object): def __init__(self,myKey,myValue): self.Key = myKey self.Value = myValue and use this object as p

Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Marko Rauhamaa
Marko Rauhamaa : >>> Surprisingly this variant could raise an unexpected exception: >>> >>> == >>> try: >>> do_interesting_stuff() >>> except ValueError: >>> try: >>> log_it() >>> finally: >>> raise >>>

about supervisor program doesn't show in web console

2015-01-30 Thread shinriyo
Hi there I am trying to use supervisord. I wrote some program in /etc/supervisord.conf file. I wrote four programs in it. However, one program can't show in the web console. the program name is "myprogram_three". My /etc/supervisord.conf file's snippet is below I modified http_port. [super

EuroPython 2015: New Code of Conduct

2015-01-30 Thread M.-A. Lemburg
For EuroPython 2015 we have chosen to use a new code of conduct (CoC) that is based on the PyCon UK Code of Conduct [1]. We think that it reads much nicer than the one we had before, while serving the same purpose. In summary: Be nice to each other - We trust that attendees

Re: about supervisor program doesn't show in web console

2015-01-30 Thread shannonlab . saiyou
I resolved I tried and reseted echo_supervisord_conf > /etc/supervisord.conf 2015年1月30日金曜日 19時26分45秒 UTC+9 shin...@gmail.com: > Hi there > > > I am trying to use supervisord. > I wrote some program in /etc/supervisord.conf file. > > I wrote four programs in it. > > However, one program can't

How to show Tail -f in supervisor's web console.

2015-01-30 Thread shannonlab . saiyou
Hello I use supervisor's web console. I touched "Tail -f" button. But, it can't show the log page. I researched the log file tail -f /tmp/supervisord.log but, it doesn't show about the bug. I would appreciate it if you help me. -- https://mail.python.org/mailman/listinfo/python-list

Re: Sort of Augmented Reality

2015-01-30 Thread franssoa
Le 30. 01. 15 03:22, Dennis Lee Bieber a écrit : Given the first, and the aircraft data, you would need to compute the rays (azimuth/elevation) from camera to each target and map those to pixels in the image... a lot of spherical trigonometry there... http://www.google.com/url?sa=t&rct

Re: Installling ADODB on an offline computer

2015-01-30 Thread bkline
On Thursday, January 29, 2015 at 8:35:50 PM UTC-5, Alan Meyer wrote: > I work on an application that uses the ActivePython compilation of > Python from ActiveState. It uses three Microsoft COM libraries that are > needed for talking to SQL Server. The libraries are: > > Microsoft Activex

Re: multiprocessing.Queue & vim python interpreter

2015-01-30 Thread unknown3000
On Friday, January 23, 2015 at 10:59:46 PM UTC-5, Cameron Simpson wrote: > On 18Jan2015 16:20, unknown3...@gmail.com wrote: > >I am experimenting on a fork of vim-plug for managing vim plugins. I wanted > >to add parallel update support for python since ruby isn't nearly as common. > >I've come

Re: parsing tree from excel sheet

2015-01-30 Thread alb
Hi Peter, I'll try to comment the code below to verify if I understood it correctly or missing some major parts. Comments are just below code with the intent to let you read the code first and my understanding afterwards. Peter Otten <__pete...@web.de> wrote: [] > $ cat parse_column_tree.py > i

Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Ian Kelly
On Fri, Jan 30, 2015 at 3:00 AM, Marko Rauhamaa wrote: > Marko Rauhamaa : > Surprisingly this variant could raise an unexpected exception: == try: do_interesting_stuff() except ValueError: try:

Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Marko Rauhamaa
Ian Kelly : > The bare raise re-raises the most recent exception that is being > handled. The "raise e" raises that exception specifically, which is > not the most recent in the case of a secondary exception. Scary. That affects all finally clauses. Must remember that. The pitfall is avoided by

Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Ian Kelly
On Fri, Jan 30, 2015 at 8:30 AM, Marko Rauhamaa wrote: > Ian Kelly : > >> The bare raise re-raises the most recent exception that is being >> handled. The "raise e" raises that exception specifically, which is >> not the most recent in the case of a secondary exception. > > Scary. That affects all

Python tracker manual password reset

2015-01-30 Thread Ian Kelly
I just tried to use the password recovery tool for the Python tracker. I entered my personal email. It sent me the confirmation email with the password reset link, which I followed. It then reset my password and sent an email to a different address, an old work address that I no longer have, so I h

Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Chris Angelico
On Sat, Jan 31, 2015 at 2:42 AM, Ian Kelly wrote: > Like I suggested earlier, just don't catch the inner exception at all. > The result will be both exceptions propagated, chained in the proper > order. So many MANY times, the best thing to do with unrecognized exceptions is simply to not catch t

Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Marko Rauhamaa
Ian Kelly : > Like I suggested earlier, just don't catch the inner exception at all. > The result will be both exceptions propagated, chained in the proper > order. Depends on the situation. Marko -- https://mail.python.org/mailman/listinfo/python-list

how to parse sys.argv as dynamic parameters to another function?

2015-01-30 Thread Robert Chen
how to parse sys.argv as dynamic parameters to another function? fun(sys.argv) in perl, this is very easy. please help. -- https://mail.python.org/mailman/listinfo/python-list

Re: how to parse sys.argv as dynamic parameters to another function?

2015-01-30 Thread Skip Montanaro
On Fri, Jan 30, 2015 at 10:09 AM, Robert Chen wrote: > > how to parse sys.argv as dynamic parameters to another function? > > > fun(sys.argv) Not sure what you mean by "dynamic", but I think you already have it, assuming fun is a function which accepts a single list of strings as its argument.

Re: how to parse sys.argv as dynamic parameters to another function?

2015-01-30 Thread Ian Kelly
On Fri, Jan 30, 2015 at 9:09 AM, Robert Chen wrote: > how to parse sys.argv as dynamic parameters to another function? > > > fun(sys.argv) > > in perl, this is very easy. please help. Do you mean that you want each item of sys.argv to be passed as a separate parameter to the function? If so, then

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Rustom Mody
On Friday, January 30, 2015 at 1:03:03 PM UTC+5:30, Christian Gollwitzer wrote: > Am 30.01.15 um 02:40 schrieb Rustom Mody: > > FORTRAN > > > > use dictionary > > type(dictionary), pointer :: d > > d=>dict_new() > > call set(d//'toto',1) > > v = d//'toto' > > call dict_free(d) > > > > The c

Re: Installling ADODB on an offline computer

2015-01-30 Thread Alan Meyer
On 01/30/2015 09:45 AM, bkl...@rksystems.com wrote: On Thursday, January 29, 2015 at 8:35:50 PM UTC-5, Alan Meyer wrote: I work on an application that uses the ActivePython compilation of Python from ActiveState. It uses three Microsoft COM libraries that are needed for talking to SQL Server.

Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Ian Kelly
On Fri, Jan 30, 2015 at 8:56 AM, Marko Rauhamaa wrote: > Ian Kelly : > >> Like I suggested earlier, just don't catch the inner exception at all. >> The result will be both exceptions propagated, chained in the proper >> order. > > Depends on the situation. Like what? If you want to specifically p

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Michael Torrie
On 01/30/2015 09:27 AM, Rustom Mody wrote: > ... if I restate that in other words it says that sufficiently > complex data structures will be beyond the reach of the standard > RAII infrastructure. > > Of course this only brings up one side of memory-mgmt problems > viz. unreclaimable memory. > >

Re: parsing tree from excel sheet

2015-01-30 Thread Peter Otten
alb wrote: > Hi Peter, I'll try to comment the code below to verify if I understood > it correctly or missing some major parts. Comments are just below code > with the intent to let you read the code first and my understanding > afterwards. Let's start with the simplest: > Peter Otten <__pete..

Re: parsing tree from excel sheet

2015-01-30 Thread Peter Otten
Peter Otten wrote: > [A, A1, A21, A22] > > Finally the append_nodes(A3, nodes) will append A3 and then return because > it has no children, and we end up with > > nodes = [A, A1, A21, A22, A3] Yay, proofreading! Both lists should contain A2: [A, A1, A2, A21, A22] nodes = [A, A1, A2, A21, A22

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Rustom Mody
On Friday, January 30, 2015 at 10:39:12 PM UTC+5:30, Michael Torrie wrote: > On 01/30/2015 09:27 AM, Rustom Mody wrote: > > ... if I restate that in other words it says that sufficiently > > complex data structures will be beyond the reach of the standard > > RAII infrastructure. > > > > Of course

RAII vs gc (was fortran lib which provide python like data type)

2015-01-30 Thread Rustom Mody
On Friday, January 30, 2015 at 11:01:50 PM UTC+5:30, Rustom Mody wrote: > On Friday, January 30, 2015 at 10:39:12 PM UTC+5:30, Michael Torrie wrote: > > On 01/30/2015 09:27 AM, Rustom Mody wrote: > > > ... if I restate that in other words it says that sufficiently > > > complex data structures will

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Michael Torrie
On 01/30/2015 10:31 AM, Rustom Mody wrote: > And what about the grey area between lightweight and heavyweight? That's what the smart pointers are for. > You say just use copy constructors and no pointers. > Can you (ie C++) guarantee that no pointer is ever copied out of > scope of these copy-co

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Paul Rubin
Michael Torrie writes: > Follow basic [C++] rules and 99% of segfaults will never happen and > the majority of leaks will not happen either. That is a safe and simple approach, but it works by copying data all over the place instead of passing pointers, resulting in performance loss. Alex Martel

Re: Python is DOOMED! Again!

2015-01-30 Thread Mario Figueiredo
In article <54ca5bbf$0$12992$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > Why should I feel guilty? You wrote: > > > "Static analysis cannot and should not clutter executable code." > > > But what are type declarations in statically typed languages lik

Re: Python is DOOMED! Again!

2015-01-30 Thread Mario Figueiredo
In article <54ca5bbf$0$12992$c3e8da3$54964...@news.astraweb.com>, steve+comp.lang.pyt...@pearwood.info says... > > > Why should I feel guilty? You wrote: > > > "Static analysis cannot and should not clutter executable code." > > > But what are type declarations in statically typed languages

Multiplexing 2 streams with asyncio

2015-01-30 Thread Paul Moore
I'm trying to get to grips with asyncio. I *think* it's a reasonable fit for my problem, but I'm not really sure - so if the answer is "you shouldn't be doing that, then that's fair enough :-) What I am trying to do is, given 2 files (the stdout and stderr from a subprocess.Popen object, as it

Re: Python is DOOMED! Again!

2015-01-30 Thread Mario Figueiredo
In article , breamore...@yahoo.co.uk says... > > No, they're not always weakly typed. The aim of the spreadsheet put up > by Skip was to sort out (roughly) which languages belong in which camp. > I do not regard myself as suitably qualified to fill the thing out. > Perhaps by now others hav

Re: Python is DOOMED! Again!

2015-01-30 Thread Skip Montanaro
On Fri, Jan 30, 2015 at 12:50 PM, Mario Figueiredo wrote: > It would help that if instead of weakly typed or strongly typed box, > they could be classified comparatively to each other. The terms are > better suited to describe two languages as they stand to each other. > > Weakly Typed --

Re: how to parse sys.argv as dynamic parameters to another function?

2015-01-30 Thread Ned Batchelder
On 1/30/15 11:28 AM, Ian Kelly wrote: On Fri, Jan 30, 2015 at 9:09 AM, Robert Chen wrote: how to parse sys.argv as dynamic parameters to another function? fun(sys.argv) in perl, this is very easy. please help. Do you mean that you want each item of sys.argv to be passed as a separate param

Re: Multiplexing 2 streams with asyncio

2015-01-30 Thread Ian Kelly
On Fri, Jan 30, 2015 at 11:45 AM, Paul Moore wrote: > 2. Because on Windows I'd have to use threads, whereas asyncio uses IO > completion ports behind the scenes (I think) which are probably a lot more > lightweight. I have no idea whether that's true, but note that add_reader() on Windows doe

Re: multiprocessing module backport from 3 to 2.7 - spawn feature

2015-01-30 Thread Sturla Molden
Skip Montanaro wrote: > Can you explain what you see as the difference between "spawn" and "fork" > in this context? Are you using Windows perhaps? I don't know anything > obviously different between the two terms on Unix systems. spawn is fork + exec. Only a handful of POSIX functions are requ

Re: multiprocessing module backport from 3 to 2.7 - spawn feature

2015-01-30 Thread Sturla Molden
Andres Riancho wrote: > Spawn, and I took that from the multiprocessing 3 documentation, will > create a new process without using fork(). > This means that no memory > is shared between the MainProcess and the spawn'ed sub-process created > by multiprocessing. If you memory map a segment with

Re: RAII vs gc (was fortran lib which provide python like data type)

2015-01-30 Thread Sturla Molden
Rustom Mody wrote: > The case of RAII vs gc is hardly conclusive: > > http://stackoverflow.com/questions/228620/garbage-collection-in-c-why The purpose of RAII is not to be an alternative to garbage collection (which the those answers imply), but to ensure deterministc execution of setup and t

Re: Python is DOOMED! Again!

2015-01-30 Thread Ian Kelly
On Fri, Jan 30, 2015 at 11:42 AM, Mario Figueiredo wrote: > To be clear, type declarations in Julia, Scala, C have the potential to > produce side-effects, can result in optimized code and can result in > compile time errors or warnings. They also affect runtime evaluation as > you could easily at

Re: multiprocessing module backport from 3 to 2.7 - spawn feature

2015-01-30 Thread Marko Rauhamaa
Sturla Molden : > Only a handful of POSIX functions are required to be "fork safe", i.e. > callable on each side of a fork without an exec. That is a pretty surprising statement. Forking without an exec is a routine way to do multiprocessing. I understand there are things to consider, but all sy

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Gregory Ewing
Michael Torrie wrote: On 01/30/2015 10:31 AM, Rustom Mody wrote: And what about the grey area between lightweight and heavyweight? That's what the smart pointers are for. I'd say it's what higher-level languages are for. :-) I'm completely convinced nowadays that there is *no* use case for

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Sturla Molden
Michael Torrie wrote: > Yes I can tell you haven't used C++. Compared to C, I've always found > memory management in C++ to be quite a lot easier. The main reason is > that C++ guarantees objects will be destroyed when going out of scope. > So when designing a class, you put any allocation rout

Re: An object is an instance (or not)?

2015-01-30 Thread Steven D'Aprano
Gregory Ewing wrote: > Steven D'Aprano wrote: >> Actually, if you look at my example, you will see that it is a method and >> it does get the self argument. Here is the critical code again: >> >> from types import MethodType >> polly.talk = MethodType( >> lambda self: print("Polly wants a spa

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Steven D'Aprano
Gregory Ewing wrote: > I'm completely convinced nowadays that there is > no use case for C++. I can think of one use-case for C++. You walk up to somebody in the street, say "I wrote my own C++ parser!", and while they are gibbering and shaking in shock, you rifle through their pockets and stea

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Steven D'Aprano
Michael Torrie wrote: > If that happened, then it's because you the programmer wanted it to > happen.  It's not just going to happen all by itself.  Yes anytime > pointers are allowed, things are potentially unsafe in the hands of a > programmer.  I'm just saying it's not nearly so bad as you make

Re: Python tracker manual password reset

2015-01-30 Thread Steven D'Aprano
Ian Kelly wrote: > I just tried to use the password recovery tool for the Python tracker. > I entered my personal email. It sent me the confirmation email with > the password reset link, which I followed. It then reset my password > and sent an email to a different address, an old work address tha

Re: The Most Diabolical Python Antipattern

2015-01-30 Thread Mark Lawrence
On 30/01/2015 08:10, Mark Lawrence wrote: On 30/01/2015 06:16, Marko Rauhamaa wrote: Ian Kelly : At least use "except Exception" instead of a bare except. Do you really want things like SystemExit and KeyboardInterrupt to get turned into 0? How about: == try

Re: multiprocessing module backport from 3 to 2.7 - spawn feature

2015-01-30 Thread Sturla Molden
On 30/01/15 23:25, Marko Rauhamaa wrote: Sturla Molden : Only a handful of POSIX functions are required to be "fork safe", i.e. callable on each side of a fork without an exec. That is a pretty surprising statement. Forking without an exec is a routine way to do multiprocessing. I understand

Create dictionary based of x items per key from two lists

2015-01-30 Thread rajanbond
I have two lists l1 = ["a","b","c","d","e","f","g","h","i","j"] l2 = ["aR","bR","cR"] l2 will always be smaller or equal to l1 numL1PerL2 = len(l1)/len(l2) I want to create a dictionary that has key from l1 and value from l2 based on numL1PerL2 So { a:aR, b:aR, c:aR, d:bR, e:bR, f:bR, g:cR

Re: Create dictionary based of x items per key from two lists

2015-01-30 Thread Chris Angelico
On Sat, Jan 31, 2015 at 1:27 PM, wrote: > l1 = ["a","b","c","d","e","f","g","h","i","j"] > l2 = ["aR","bR","cR"] > > l2 will always be smaller or equal to l1 > > numL1PerL2 = len(l1)/len(l2) > > I want to create a dictionary that has key from l1 and value from l2 based on > numL1PerL2 > > So >

Re: Sort of Augmented Reality

2015-01-30 Thread Larry Hudson
On 01/29/2015 06:55 PM, Rustom Mody wrote: [snip...] Like smelly cheese and classical music, math is an acquired taste. Actually enjoyable once you get past the initiation This comment is OT, irrelevant and only about myself... I found the appreciation of classical music instinctive and immed

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Michael Torrie
On 01/30/2015 04:12 PM, Sturla Molden wrote: > Michael Torrie wrote: > >> Yes I can tell you haven't used C++. Compared to C, I've always found >> memory management in C++ to be quite a lot easier. The main reason is >> that C++ guarantees objects will be destroyed when going out of scope. >> S

Re: [OT] fortran lib which provide python like data type

2015-01-30 Thread Michael Torrie
On 01/30/2015 04:50 PM, Steven D'Aprano wrote: > Oh great. So if the average application creates a hundred thousand pointers > of the course of a session, you'll only have a thousand or so seg faults > and leaks. > > Well, that certainly explains this: > > https://access.redhat.com/articles/13322

inet_http_server is only one username and passowrd in supervisor

2015-01-30 Thread shinriyo
Hi there I use supervisor. in the [inet_http_server] section, there are only one username and password username=user password=pass Do you know how to add more than two users. Thank you. -- https://mail.python.org/mailman/listinfo/python-list