Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Steven D'Aprano
On Sat, 17 Dec 2011 23:33:27 -0600, Evan Driscoll wrote: > I do have one more thing to point out, which is that currently the > Python vararg syntax is very difficult to Google for. You're coming in late to the conversation, but that was literally the second thing pointed out by the original po

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Evan Driscoll
On 12/17/2011 23:33, Evan Driscoll wrote: > I do have one more thing to point out, which is that currently the > Python vararg syntax is very difficult to Google for. In the first pages > of the four searches matching "python (function)? (star | asterisk)", > there was just one relevant hit on pyth

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Evan Driscoll
On 12/17/2011 22:52, buck wrote: > Try these on for size. > > head, @tuple tail = sequence > def foo(@list args, @dict kwargs): pass > foo(@args, @kwargs) > > For backward compatibility, we could say that the unary * is identical to > @list and unary ** is identical to @dict. > I

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Chris Angelico
On Sun, Dec 18, 2011 at 3:52 PM, buck wrote: > The last one looks decorator-ish, but maybe that's proper. The implementation > of this would be quite decorator-like: take the "normal" value of x, pass it > through the indicated function, assign that value back to x. > > Try these on for size. >

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Chris Angelico
On Sun, Dec 18, 2011 at 3:43 PM, Evan Driscoll wrote: > On 12/17/2011 21:42, Chris Angelico wrote: >> Welcome to the list! If you're curious as to what's happened, check >> the archives: >> http://mail.python.org/pipermail/python-list/ > Thanks! Incidentally, is there a good way to respond to the

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread buck
I like the spirit of this. Let's look at your examples. > Examples of use: > head, tail::tuple = ::sequence > def foo(args::list, kwargs::dict): pass > foo(::args, ::kwargs) My initial reaction was "nonono!", but this is simply because of the ugliness. The double-colon is very vis

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Evan Driscoll
On 12/17/2011 21:42, Chris Angelico wrote: > Welcome to the list! If you're curious as to what's happened, check > the archives: > http://mail.python.org/pipermail/python-list/ Thanks! Incidentally, is there a good way to respond to the original post in this thread, considering it wasn't delivered

Debugging a difficult refcount issue.

2011-12-17 Thread buck
I'm getting a fatal python error "Fatal Python error: GC object already tracked"[1]. Using gdb, I've pinpointed the place where the error is detected. It is an empty dictionary which is marked as in-use. This is somewhat helpful since I can reliably find the memory address of the dict, but it d

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Chris Angelico
On Sun, Dec 18, 2011 at 2:59 PM, Roy Smith wrote: > It is possible for 1 + "one" to be equal to 2 in C or C++.  All it takes > is for the string literal to be located at memory location 1.  Not > likely, but nothing in the language prevents it. Not quite; 1 + "one" will be "ne", which might happe

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Roy Smith
In article <4eed5eef$0$29979$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > some academic languages may be > entire strong; but most real-world languages include elements of both. > Most commonly coercing ints to floats. Early Fortran compilers did not automatically promote int

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Chris Angelico
On Sun, Dec 18, 2011 at 2:03 PM, Evan Driscoll wrote: > Sorry, I just subscribed to the list so am stepping in mid-conversation, Welcome to the list! If you're curious as to what's happened, check the archives: http://mail.python.org/pipermail/python-list/ > Something like ML or Haskell, which d

Newman's community structure algorithms

2011-12-17 Thread Shafique, M. (UNU-MERIT)
Hello, I am in need of the python or matlab implementation of following algorithms: Newman, M. E. J. 2006. Modularity and community structure in networks. PNAS 103(23): 8577-8582. Newman, M. E. J. and Leicht, E. A. 2007. Mixture models and exploratory analysis in networks. PNAS 104(23): 9564-956

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Steven D'Aprano
On Sun, 18 Dec 2011 13:45:35 +1100, Chris Angelico wrote: > On Sun, Dec 18, 2011 at 11:59 AM, Steven D'Aprano > wrote: >> The usual test of a weakly-typed language is that "1"+1 succeeds (and >> usually gives 2), as in Perl but not Python. I believe you are >> confusing weak typing with dynamic t

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Evan Driscoll
On 12/17/2011 21:03, Evan Driscoll wrote: > Personally I'd put Python even weaker on account of things such as > '[1,2]*2' and '1 < True' being allowed, but on the other hand it > doesn't allow "1"+1. Not to mention duck typing, which under my definition I'd argue is pretty much the weakest of typ

Re: root[:]=[root,root]

2011-12-17 Thread Terry Reedy
On 12/16/2011 9:40 PM, YAN HUA wrote: Hi,all. Could anybody tell how this code works? >>> root = [None, None] >>> root[:] = [root, root] >>> root [[...], [...]] >>> root[0] [[...], [...]] >>> root[0][0][1][1][0][0][0][1][1] [[...], [...]] A simpler example: >>> l = [] >>> l.append(l) >>> l

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Evan Driscoll
On 12/17/2011 20:45, Chris Angelico wrote: > I'd go stronger than "usually" there. If "1"+1 results in "11", then > that's not weak typing but rather a convenient syntax for > stringification - if every object can (or must) provide a to-string > method, and concatenating anything to a string causes

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Chris Angelico
On Sun, Dec 18, 2011 at 11:59 AM, Steven D'Aprano wrote: > The usual test of a weakly-typed language is that "1"+1 succeeds (and > usually gives 2), as in Perl but not Python. I believe you are confusing > weak typing with dynamic typing, a common mistake. I'd go stronger than "usually" there. If

Re: AttributeError in "with" statement (3.2.2)

2011-12-17 Thread Terry Reedy
On 12/16/2011 8:26 PM, Steven D'Aprano wrote: On Fri, 16 Dec 2011 17:05:57 -0500, Terry Reedy wrote: It is am important distinction [unbound versus bound] It is not an important distinction, and I am not confusing the two. So we agree on the distinction but disagree on its importance. Let

Parsing stream of JSON objects incrementally

2011-12-17 Thread Evan Driscoll
I'm interested in writing two programs, A and B, which communicate using JSON. At a high level, A wants to transfer an array to B. However, I would very much like to make it possible for A and B to run in parallel, so my current plan is to have A output and B read a *sequence* of JSON objects. In

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Steven D'Aprano
On Sat, 17 Dec 2011 06:38:22 -0800, Eelco wrote: > Type constraints: > > In case the asterisk is not used to signal unpacking, but rather to > signal packing, its semantics is essentially that of a type constraint. "Type constraint" normally refers to type restrictions on *input*: it is a restr

PyCon US 2012 sprints

2011-12-17 Thread Ricardo Bánffy
Hi folks. Next March I'm planning to attend PyCon US (for the first time) and stay for the sprints. I am not sure how they work, however. Are there any "first-timer guide to PyCon sprints"? -- Ricardo Bánffy http://www.dieblinkenlights.com http://twitter.com/rbanffy -- http://mail.python.org/ma

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Steven D'Aprano
On Sat, 17 Dec 2011 12:11:04 -0800, Eelco wrote: > > One can not state in a single line what the asterisk > > operator does; ... > To cut short this line of discussion; I meant the asterisk symbol purely > in the context of collection packing/unpacking. Of course it has other > uses too. > > Eve

Re: logging issues

2011-12-17 Thread Vinay Sajip
On Dec 13, 5:03 pm, Andrea Crotti wrote: > The set_verbosity seems to do its job, the second is also > called and the filters are added but I don't see the output > formatted as it should.. Generally speaking, you should only do logging configuration once, as Jean-Michel said - from your main()

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Eelco
On Dec 17, 6:18 pm, Chris Angelico wrote: > On Sun, Dec 18, 2011 at 4:14 AM, Roy Smith wrote: > > Import wildcarding? > > That's not an operator, any more than it is when used in filename > globbing. The asterisk _character_ has many meanings beyond those of > the operators * and **. > > ChrisA

Re: % is not an operator [was Re: Verbose and flexible args and kwargs syntax]

2011-12-17 Thread Grant Edwards
On 2011-12-16, Gregory Ewing wrote: > Eelco wrote: >> the actual english usage of the phrase, which omits >> the negation completely :). (I could care less) > > No, that's the American usage. That's the _ignorant_ American usage. Americans with a clue use the "couldn't" version. I won't comment

Bug in multiprocessing.reduction?

2011-12-17 Thread Yaşar Arabacı
You can see my all code below, theoritically that code should work I guess. But I keep getting this error: [SUBWARNING/MainProcess] thread for sharing handles raised exception : --- Traceback (most recent call last): File "

Python install regression test fail

2011-12-17 Thread John Nagle
Here's a result from "make", "make test" of a fresh download of Python 2.7.2 on Linux 2.6.18-1.2239.fc5smp: 350 tests OK. 2 tests failed: test_os test_site 35 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_codecmaps_cn test_codecmap

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Chris Angelico
On Sun, Dec 18, 2011 at 4:14 AM, Roy Smith wrote: > Import wildcarding? That's not an operator, any more than it is when used in filename globbing. The asterisk _character_ has many meanings beyond those of the operators * and **. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Roy Smith
In article <4eeccabe$0$29979$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Sat, 17 Dec 2011 06:38:22 -0800, Eelco wrote: > > > One can not state in a single line what the asterisk > > operator does; > > Multiplication, exponentiation, sequence packing/unpacking, and varargs

Re: Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Steven D'Aprano
On Sat, 17 Dec 2011 06:38:22 -0800, Eelco wrote: > One can not state in a single line what the asterisk > operator does; Multiplication, exponentiation, sequence packing/unpacking, and varargs. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Help about Xlib Library in Python

2011-12-17 Thread 88888 Dihedral
On Saturday, December 17, 2011 11:22:32 PM UTC+8, Alexander Kapps wrote: > On 16.12.2011 05:55, 阮铮 wrote: > > Hi, > > > > A question about Xlib Library in Python troubled me for several days > > and I finally found this email list. I hope someone could answer my > > question. I think it is easy for

Re: Help about Xlib Library in Python

2011-12-17 Thread Alexander Kapps
On 16.12.2011 05:55, 阮铮 wrote: Hi, A question about Xlib Library in Python troubled me for several days and I finally found this email list. I hope someone could answer my question. I think it is easy for experienced user. I would like to write a small script to response my mouse click in root

Pythonification of the asterisk-based collection packing/unpacking syntax

2011-12-17 Thread Eelco
This is a follow-up discussion on my earlier PEP-suggestion. Ive integrated the insights collected during the previous discussion, and tried to regroup my arguments for a second round of feedback. Thanks to everybody who gave useful feedback the last time. PEP Proposal: Pythonification of the ast

Online Data Entry Jobs Without Investment http://ponlinejobs.yolasite.com/

2011-12-17 Thread prabhakaran k
Online Data Entry Jobs Without Investment http://ponlinejobs.yolasite.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: calculate difference between two timestamps [newbie]

2011-12-17 Thread Günther Dietrich
nukeymusic wrote: >I'm trying to calculate the difference in seconds between two [...] >>> import datetime >>> date1 = datetime.datetime.strptime("Dec-13-09:47:12", "%b-%d-%H:%M:%S") >>> date2 = datetime.datetime.strptime("Dec-13-09:47:39", "%b-%d-%H:%M:%S") >>> delta = date2 - date1 >>> delta_

Re: calculate difference between two timestamps [newbie]

2011-12-17 Thread Vince
On Sat, Dec 17, 2011 at 02:19:44AM -0800, nukeymusic wrote: > I'm trying to calculate the difference in seconds between two > timestamps, but I'm totally stuck: > date1="Dec-13-09:47:12" > date2="Dec-13-09:47:39" > >>> diff=datetime.date(date2)-datetime.date(date1) > Traceback (most recent call las

Re: calculate difference between two timestamps [newbie]

2011-12-17 Thread Vincent Vande Vyvre
Le 17/12/11 11:19, nukeymusic a écrit : I'm trying to calculate the difference in seconds between two timestamps, but I'm totally stuck: date1="Dec-13-09:47:12" date2="Dec-13-09:47:39" diff=datetime.date(date2)-datetime.date(date1)

Re: calculate difference between two timestamps [newbie]

2011-12-17 Thread Dave Angel
On 12/17/2011 05:19 AM, nukeymusic wrote: I'm trying to calculate the difference in seconds between two timestamps, but I'm totally stuck: date1="Dec-13-09:47:12" date2="Dec-13-09:47:39" diff=datetime.date(date2)-datetime.date(date1) Traceback (most recent call last): File "", line 1, in Typ

calculate difference between two timestamps [newbie]

2011-12-17 Thread nukeymusic
I'm trying to calculate the difference in seconds between two timestamps, but I'm totally stuck: date1="Dec-13-09:47:12" date2="Dec-13-09:47:39" >>> diff=datetime.date(date2)-datetime.date(date1) Traceback (most recent call last): File "", line 1, in TypeError: an integer is required struct_dat