Re: Future of Pypy?

2015-02-22 Thread Steven D'Aprano
Paul Rubin wrote: > Steven D'Aprano writes: >> I'm sorry, but the instant somebody says "eliminate the GIL", they lose >> credibility with me. Yes yes, I know that in *your* specific case you've >> done your research and (1) multi-threaded code is the best solution for >> your application and (2)

Re: Future of Pypy?

2015-02-22 Thread Ryan Stuart
On Mon Feb 23 2015 at 4:15:42 PM Paul Rubin wrote: > > What do you mean about Queues working with processes? I meant > Queue.Queue. There is multiprocessing.Queue but that's much less > capable, and it uses cumbersome IPC like pipes or sockets instead of a > lighter weight lock. Threads can als

Re: Design thought for callbacks

2015-02-22 Thread Ian Kelly
On Sun, Feb 22, 2015 at 7:22 AM, Cem Karan wrote: > > On Feb 22, 2015, at 5:15 AM, Gregory Ewing > wrote: > >> Frank Millman wrote: >>> "In order to inform users that certain bits of state have changed, I >>> require them to register a callback with my code." >>> This sounds to me like a pub/su

Re: id() and is operator

2015-02-22 Thread Marko Rauhamaa
Terry Reedy : > On 2/22/2015 4:25 PM, Marko Rauhamaa wrote: >> This is a true statement: >> >> If X is Y, then id(X) == id(Y). >> >> However, this is generally not a true statement: >> >> If X is Y, then id(X) is id(Y). > > If X and Y exist at the *same time*, then (X is Y) == (id(X) is id

Re: Future of Pypy?

2015-02-22 Thread Terry Reedy
On 2/22/2015 7:45 AM, Dave Farrance wrote: As an engineer, I can quickly knock together behavioural models of electronic circuits, complete units, and control systems in Python, then annoyingly in a few recent cases, have to re-write in C for speed. I've tried PyPy, the just-in-time compiler fo

Re: id() and is operator

2015-02-22 Thread Gary Herron
On 02/22/2015 10:02 PM, Terry Reedy wrote: On 2/22/2015 4:25 PM, Marko Rauhamaa wrote: LJ : id(b[0]) 4582 [...] id(b[2]) 4582 Please correct me if I am wrong, but according to this b[2] and b[0] are the same object. Now, b[0] is b[2] False This is a true statement: If

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Ryan Stuart writes: > I think that is a pretty accurate summary. In fact, the article even > says that. So, just to iterate its point, if you are using > non-blocking Queues to communicate to these threads, then you just > have a communicating event loop. Given that Queues work perfectly with > wi

Re: id() and is operator

2015-02-22 Thread Terry Reedy
On 2/22/2015 12:53 PM, LJ wrote: Hi everyone. Quick question here. Lets suppose if have the following numpy array: b=np.array([[0]*2]*3) and then: id(b[0]) 4582 id(b[1]) 45857512 id(b[2]) 4582 Please correct me if I am wrong, You are, as other explained > but according to th

Re: id() and is operator

2015-02-22 Thread Terry Reedy
On 2/22/2015 4:25 PM, Marko Rauhamaa wrote: LJ : id(b[0]) 4582 [...] id(b[2]) 4582 Please correct me if I am wrong, but according to this b[2] and b[0] are the same object. Now, b[0] is b[2] False This is a true statement: If X is Y, then id(X) == id(Y). However, this

Re: Future of Pypy?

2015-02-22 Thread Ryan Stuart
On Mon Feb 23 2015 at 1:50:40 PM Paul Rubin wrote: > That article is about the hazards of mutable state shared between > threads. The key to using threads safely is to not do that. So the > "transfer" example in the article would instead be a message handler in > the thread holding the account

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Ryan Stuart writes: > Many people have written at length about why it's bad. The most recent > example I have come across is here -> > https://glyph.twistedmatrix.com/2014/02/unyielding.html That article is about the hazards of mutable state shared between threads. The key to using threads safel

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Ben Finney
Chris Angelico writes: > That said, though, there's probably a lot of code out there that > depends on backslashes being non-special, so it's quite probably > something that can't be changed. But it'd be nice to be able to turn > on a warning for it. If you're motivated to see such warnings, an

Re: Future of Pypy?

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 2:16 PM, Ryan Stuart wrote: > Many people have written at length about why it's bad. The most recent > example I have come across is here -> > https://glyph.twistedmatrix.com/2014/02/unyielding.html > > It's not a specific Python problem. I must be in the limited crowd that

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 1:41 PM, Ben Finney wrote: > Right. Text strings literals are documented to work that way > https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str>, > which refers the reader to the language reference > https://docs.python.org/3/reference/lexical_analysis.ht

Re: Future of Pypy?

2015-02-22 Thread Ryan Stuart
On Mon Feb 23 2015 at 12:05:46 PM Paul Rubin wrote: > I don't see what the big deal is. I hear tons of horror stories about > threads and I believe them, but the thing is, they almost always revolve > around acquiring and releasing locks in the wrong order, forgetting to > lock things, stuff lik

Re: calling subprocess

2015-02-22 Thread Dave Angel
On 02/22/2015 09:38 PM, Dave Angel wrote: On 02/22/2015 08:13 PM, jkuplin...@gmail.com wrote: OK (1) sorry about for/from That's not what you should be sorry about. You should be sorry you didn't use cut&paste. (2) print() sounds nice, but fact is , no matter what I try, i always get C:\\a

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Dave Angel
On 02/22/2015 09:41 PM, Ben Finney wrote: Chris Angelico writes: In Python, unrecognized escape sequences are treated literally, without (as far as I can tell) any sort of warning or anything. Right. Text strings literals are documented to work that way https://docs.python.org/3/library/stdt

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 1:41 PM, Ben Finney wrote: > Chris Angelico writes: > >> Why is it that Python interprets them this way, and doesn't even give >> a warning? > > Because the interpretation of those literals is unambiguous and correct. And it also implies that never, in the entire infinite

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Laura Creighton writes: > And given that Lennart is a friend, well really a good friend of my > lover and a something-better- than-an-acquaintance with me I > should make the effort to get these two under the same roof (mine, by > preference) for the fun of the experience. Oh cool, right, I

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Dave Angel
On 02/22/2015 09:29 PM, Chris Angelico wrote: In Python, unrecognized escape sequences are treated literally, without (as far as I can tell) any sort of warning or anything. This can mask bugs, especially when Windows path names are used: 'C:\sqlite\Beginner.db' 'C:\\sqlite\\Beginner.db' 'c:\

Re: Unrecognized backslash escapes in string literals

2015-02-22 Thread Ben Finney
Chris Angelico writes: > In Python, unrecognized escape sequences are treated literally, > without (as far as I can tell) any sort of warning or anything. Right. Text strings literals are documented to work that way https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str>, which r

Re: calling subprocess

2015-02-22 Thread Dave Angel
On 02/22/2015 08:13 PM, jkuplin...@gmail.com wrote: OK (1) sorry about for/from That's not what you should be sorry about. You should be sorry you didn't use cut&paste. (2) print() sounds nice, but fact is , no matter what I try, i always get C:\\apps instead of c:\apps. So in this sense

Unrecognized backslash escapes in string literals

2015-02-22 Thread Chris Angelico
In Python, unrecognized escape sequences are treated literally, without (as far as I can tell) any sort of warning or anything. This can mask bugs, especially when Windows path names are used: >>> 'C:\sqlite\Beginner.db' 'C:\\sqlite\\Beginner.db' >>> 'c:\sqlite\beginner.db' 'c:\\sqlite\x08eginner.

Re: Future of Pypy?

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 1:04 PM, Paul Rubin wrote: >> if you're running single-thread code on a single-core machine and >> still complaining about the GIL, you have no clue. > > Even the Raspberry Pi has 4 cores now, and fancy smartphones have had > them for years. Single core cpu's are specializ

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Steven D'Aprano writes: > I'm sorry, but the instant somebody says "eliminate the GIL", they lose > credibility with me. Yes yes, I know that in *your* specific case you've > done your research and (1) multi-threaded code is the best solution for > your application and (2) alternatives aren't suit

Re: id() and is operator

2015-02-22 Thread Steven D'Aprano
LJ wrote: > Hi everyone. Quick question here. Lets suppose if have the following numpy > array: > > b=np.array([[0]*2]*3) > > and then: > id(b[0]) > 4582 id(b[1]) > 45857512 id(b[2]) > 4582 > > Please correct me if I am wrong, but according to this b[2] and b[0] are > th

Re: calling subprocess

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 12:13 PM, wrote: > (2) print() sounds nice, but fact is , no matter what I try, i always get > C:\\apps instead of c:\apps. So in this sense print() doesn't help much. > Obviously i'm doing something wrong -- which is what you perhaps call shotgun > debugging; but that'

Re: Future of Pypy?

2015-02-22 Thread Steven D'Aprano
Paul Rubin wrote: > Laura Creighton writes: >> Because one thing we do know is that people who are completely and >> utterly ignorant about whether having multiple cores will improve >> their code still want to use a language that lets them use the >> multiple processors. If the TM dream of havi

Re: calling subprocess

2015-02-22 Thread jkuplinsky
On Sunday, February 22, 2015 at 5:22:24 PM UTC-5, Chris Angelico wrote: > On Mon, Feb 23, 2015 at 9:06 AM, wrote: > > I thought this would be easy: > > > > > > for subprocess import call > > call (['cd', r'C:\apps'], shell = True) > > > > > > It doesn't work -- tried with/without prefix r, escape

Re: try pattern for database connection with the close method

2015-02-22 Thread Mario Figueiredo
On Sat, 21 Feb 2015 16:22:36 +0100, Peter Otten <__pete...@web.de> wrote: > >Why would you care about a few lines? You don't repeat them, do you? Put the >code into a function or a context manager and invoke it with Thanks for the suggestions that followed. -- https://mail.python.org/mailman/li

Re: try pattern for database connection with the close method

2015-02-22 Thread Mario Figueiredo
On Sun, 22 Feb 2015 13:15:09 -0600, Skip Montanaro wrote: > >Sorry, I haven't paid careful attention to this thread, so perhaps >this has already been suggested, however... Can't you write your own >class which delegates to the necessary sqlite3 bits and has a context >manager with the desired be

Re: try pattern for database connection with the close method

2015-02-22 Thread Mario Figueiredo
On Sun, 22 Feb 2015 19:07:03 +, Mark Lawrence wrote: > >Looks like you're correct. Knock me down with a feather, Clevor Trevor. It took me by surprise when I first encountered it too. The rationale apparently is that the context manager is strictly a transactional feature, allowing for mult

Re: Design thought for callbacks

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 9:29 AM, Laura Creighton wrote: > But that is not so surprising. How many people use WeakSets for > _anything_? I've never used them, aside from 'ooh! cool shiny > new language feature! Let's kick it around the park!' That people > aren't familiar with WeakSets doesn't

Re: Design thought for callbacks

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 17:09:01 -0500, Cem Karan writes: >Documentation is a given; it MUST be there. That said, documenting >something, but still making it surprising, is a bad idea. For >example, several people have been strongly against using a WeakSet to >hold callbacks because the

Re: calling subprocess

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 9:06 AM, wrote: > I thought this would be easy: > > > for subprocess import call > call (['cd', r'C:\apps'], shell = True) > > > It doesn't work -- tried with/without prefix r, escaped backslashes, triple > quotes, str(), .. nothing seems to work (it doesn't complain, but

Re: calling subprocess

2015-02-22 Thread Tim Golden
On 22/02/2015 22:06, jkuplin...@gmail.com wrote: Hi, I thought this would be easy: for subprocess import call call (['cd', r'C:\apps'], shell = True) It doesn't work -- tried with/without prefix r, escaped backslashes, triple quotes, str(), .. nothing seems to work (it doesn't complain, but

Re: Future of Pypy?

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 12:14:45 -0800, Paul Rubin writes: >Laura Creighton writes: >> The GIL isn't going away from PyPy any time real soon, alas. > >I thought the GIL's main purpose was to avoid having to lock all the >CPython refcount updates, so if PyPy has tracing GC, why is there st

calling subprocess

2015-02-22 Thread jkuplinsky
Hi, I thought this would be easy: for subprocess import call call (['cd', r'C:\apps'], shell = True) It doesn't work -- tried with/without prefix r, escaped backslashes, triple quotes, str(), .. nothing seems to work (it doesn't complain, but it doesn't change directories either) -- what am

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 22, 2015, at 4:34 PM, Marko Rauhamaa wrote: > Cem Karan : > >> My goal is to make things as pythonic (whatever that means in this >> case) and obvious as possible. Ideally, a novice can more or less >> guess what will happen with my API without really having to read the >> documentation

Re: Future of Pypy?

2015-02-22 Thread Laura Creighton
Good news -- it seems to be working fine with PyPy. https://travis-ci.org/hugovk/Pillow/builds for me, not extensively tested, it just seems to be working. I have several pypy's floating around here, each within its own virtualenv. If you aren't familiar with virtualenv, read all about it here:

Re: id() and is operator

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 8:25 AM, Marko Rauhamaa wrote: > This is a true statement: > >If X is Y, then id(X) == id(Y). > > However, this is generally not a true statement: > >If X is Y, then id(X) is id(Y). Irrelevant, because the identities of equal integers didn't come into this. ChrisA

Re: Design thought for callbacks

2015-02-22 Thread Marko Rauhamaa
Cem Karan : > My goal is to make things as pythonic (whatever that means in this > case) and obvious as possible. Ideally, a novice can more or less > guess what will happen with my API without really having to read the > documentation on it. If you try to shield your user from the complexities o

Re: id() and is operator

2015-02-22 Thread Marko Rauhamaa
LJ : id(b[0]) > 4582 [...] id(b[2]) > 4582 > > Please correct me if I am wrong, but according to this b[2] and b[0] > are the same object. Now, > b[0] is b[2] > False This is a true statement: If X is Y, then id(X) == id(Y). However, this is generally not a true statem

Re: Question on asyncio

2015-02-22 Thread Marko Rauhamaa
pfranke...@gmail.com: > I have some functions which are reading values from hardware. If one > of the values changes, I want a corresponding notification to the > connected clients. The network part shouldn't be the problem. Here is > what I got so far: > > @asyncio.coroutine > def check(): > ol

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 22, 2015, at 4:02 PM, Ethan Furman wrote: > On 02/22/2015 05:13 AM, Cem Karan wrote: > >> Output: >> From Evil Zombie: Surprise! >> From Your Significant Other: Surprise! >> >> In this case, the user made an error (just as Marko said in his earlier >> message), >> and forgot about the

Re: Design thought for callbacks

2015-02-22 Thread Ethan Furman
On 02/22/2015 05:13 AM, Cem Karan wrote: > Output: > From Evil Zombie: Surprise! > From Your Significant Other: Surprise! > > In this case, the user made an error (just as Marko said in his earlier > message), > and forgot about the callback he registered with the library. The callback > isn't

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Laura Creighton writes: > The GIL isn't going away from PyPy any time real soon, alas. I thought the GIL's main purpose was to avoid having to lock all the CPython refcount updates, so if PyPy has tracing GC, why is there still a GIL? And how is TM going to help with parallelism if the GIL is st

Re: id() and is operator

2015-02-22 Thread Laura Creighton
Ooops, I missed the numpy, so I thought that it was the contents of the array that was causing the problem. My very bad. Apologies. Laura -- https://mail.python.org/mailman/listinfo/python-list

Re: Future of Pypy?

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 11:02:29 -0800, Paul Rubin writes: >Laura Creighton writes: >> Because one thing we do know is that people who are completely and >> utterly ignorant about whether having multiple cores will improve >> their code still want to use a language that lets them use the

Re: try pattern for database connection with the close method

2015-02-22 Thread Skip Montanaro
On Sun, Feb 22, 2015 at 12:41 PM, Mario Figueiredo wrote: > The sqlite context manager doesn't close a database connection on > exit. It only ensures, commits and rollbacks are performed. Sorry, I haven't paid careful attention to this thread, so perhaps this has already been suggested, however..

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
Dave Farrance wrote: >Steven D'Aprano wrote: > >>I assume you're talking about drawing graphics rather than writing text. Can >>you tell us which specific library or libraries won't run under PyPy? > >Yes, mainly the graphics. I'm a hardware engineer, not a software >engineer, so I might well b

Re: id() and is operator

2015-02-22 Thread Gary Herron
On 02/22/2015 09:53 AM, LJ wrote: Hi everyone. Quick question here. Lets suppose if have the following numpy array: b=np.array([[0]*2]*3) and then: id(b[0]) 4582 id(b[1]) 45857512 id(b[2]) 4582 Please correct me if I am wrong, but according to this b[2] and b[0] are the same o

Re: id() and is operator

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 5:13 AM, Laura Creighton wrote: > In a message of Sun, 22 Feb 2015 09:53:33 -0800, LJ writes: >>Hi everyone. Quick question here. Lets suppose if have the following numpy >>array: >> >>b=np.array([[0]*2]*3) >> >>and then: >> > id(b[0]) >>4582 > id(b[1]) >>45857

Re: Accessible tools

2015-02-22 Thread Tim Chase
On 2015-02-22 20:29, Jacob Kruger wrote: > jaws, doesn't always cooperate perfectly with command line/console > interface I've heard that on multiple occasions. Since I mostly work with Linux, the only terminal-with-screen-reader hints I've heard involve using TeraTerm as the SSH client with NVDA

Re: try pattern for database connection with the close method

2015-02-22 Thread Mark Lawrence
On 22/02/2015 18:41, Mario Figueiredo wrote: On Sat, 21 Feb 2015 12:22:58 +, Mark Lawrence wrote: Use your context manager at the outer level. import sqlite3 as lite try: with lite.connect('data.db') as db: try: db.execute(sql, parms) except lite.IntegrityError:

Re: Future of Pypy?

2015-02-22 Thread Paul Rubin
Laura Creighton writes: > Because one thing we do know is that people who are completely and > utterly ignorant about whether having multiple cores will improve > their code still want to use a language that lets them use the > multiple processors. If the TM dream of having that just happen, > se

Re: try pattern for database connection with the close method

2015-02-22 Thread Mario Figueiredo
On Sat, 21 Feb 2015 12:22:58 +, Mark Lawrence wrote: > >Use your context manager at the outer level. > >import sqlite3 as lite > >try: > with lite.connect('data.db') as db: > try: > db.execute(sql, parms) > except lite.IntegrityError: > raise ValueError('invalid da

Re: Accessible tools

2015-02-22 Thread Jacob Kruger
- Original Message - From: "Tim Chase" Subject: Re: Accessible tools While my experience has shown most of your items to be true, I'd contend that • Do not, have access to debugging tools. is mistaken or at least misinformed. For Python, I use the "pdb" module all the time, and

Re: How to design a search engine in Python?

2015-02-22 Thread subhabangalore
On Sunday, February 22, 2015 at 2:42:48 PM UTC+5:30, Laura Creighton wrote: > In a message of Sat, 21 Feb 2015 22:07:30 -0800, write > >Dear Sir, > > > >Thank you for your kind suggestion. Let me traverse one by one. > >My special feature is generally Semantic Search, but I am trying to build > >

Re: id() and is operator

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 09:53:33 -0800, LJ writes: >Hi everyone. Quick question here. Lets suppose if have the following numpy >array: > >b=np.array([[0]*2]*3) > >and then: > id(b[0]) >4582 id(b[1]) >45857512 id(b[2]) >4582 > >Please correct me if I am wrong, but ac

id() and is operator

2015-02-22 Thread LJ
Hi everyone. Quick question here. Lets suppose if have the following numpy array: b=np.array([[0]*2]*3) and then: >>> id(b[0]) 4582 >>> id(b[1]) 45857512 >>> id(b[2]) 4582 Please correct me if I am wrong, but according to this b[2] and b[0] are the same object. Now, >>> b[0] is b[2]

Question on asyncio

2015-02-22 Thread pfranken85
Hello! I am just trying to get familiar with asyncio. It seems to be a good thing, however, I am still having troubles and feel pretty puzzled although I think I got the point what async IO means. This is the problem I am trying to accomplish: I have some functions which are reading values fro

Re: Future of Pypy?

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 15:36:42 +, Dave Farrance writes: >Laura Creighton wrote: > >>I don't understand 'an interpreter rather than a JIT'. PyPy has a >>JIT, that sort of is the whole point. > >Yes. I meant that from my end-user, non-software-engineer perspective, it >looked as tho

Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements

2015-02-22 Thread duncan smith
On 21/02/15 19:46, TommyVee wrote: > Start off with sets of elements as follows: > > 1. A,B,E,F > 2. G,H,L,P,Q > 3. C,D,E,F > 4. E,X,Z > 5. L,M,R > 6. O,M,Y > > Note that sets 1, 3 and 4 all have the element 'E' in common, therefore > they are "related" and form the following superset: > > A,B,C

Re: Algorithm for Creating Supersets of Smaller Sets Based on Common Elements

2015-02-22 Thread Peter Pearson
On Sat, 21 Feb 2015 14:46:26 -0500, TommyVee wrote: > Start off with sets of elements as follows: > > 1. A,B,E,F > 2. G,H,L,P,Q > 3. C,D,E,F > 4. E,X,Z > 5. L,M,R > 6. O,M,Y > > Note that sets 1, 3 and 4 all have the element 'E' in common, therefore they > are "related" and form the following supe

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
Steven D'Aprano wrote: >I assume you're talking about drawing graphics rather than writing text. Can >you tell us which specific library or libraries won't run under PyPy? Yes, mainly the graphics. I'm a hardware engineer, not a software engineer, so I might well be misunderstanding PyPy's curr

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
Laura Creighton wrote: >I don't understand 'an interpreter rather than a JIT'. PyPy has a >JIT, that sort of is the whole point. Yes. I meant that from my end-user, non-software-engineer perspective, it looked as though CPython was proceeding with leaps and bounds and that PyPy remained mostly

Re: Future of Pypy?

2015-02-22 Thread Dave Farrance
jkn wrote: > I'm curious what ...behavioural... models you are creating quickly in > Python that then need rewriting in C for speed. SPICE? some other CAD? > Might be interesting to learn more about what and how you are actually > doing. The convert-to-C cases were complex filtering functions.

Re: Standard

2015-02-22 Thread Steven D'Aprano
Skip Montanaro wrote: > On Thu, Feb 19, 2015 at 10:27 AM, Phillip Fleming > wrote: >> In my opinion, Python will not take off like C/C++ if there is no ANSI >> standard. > > On one side of your statement, what makes you think Python ever wanted > to "take off like C/C++"? On the other side, ther

Re: What behavior would you expect?

2015-02-22 Thread Tim Chase
On 2015-02-19 22:55, Jason Friedman wrote: > > If you're going to call listdir, you probably want to use fnmatch > > directly. > > > > fnmatch seems to be silent on non-existent directories: > python -c 'import fnmatch; fnmatch.fnmatch("/no/such/path", "*")' a better test would be glob.glob as f

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 22, 2015, at 5:15 AM, Gregory Ewing wrote: > Frank Millman wrote: >> "In order to inform users that certain bits of state have changed, I require >> them to register a callback with my code." >> This sounds to me like a pub/sub scenario. When a 'listener' object comes >> into existence

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 22, 2015, at 7:46 AM, Marko Rauhamaa wrote: > Cem Karan : > >> On Feb 21, 2015, at 12:08 PM, Marko Rauhamaa wrote: >>> Maybe the logic of the receiving object isn't prepared for the callback >>> anymore after an intervening event. >>> >>> The problem then, of course, is in the logic an

Re: Standard

2015-02-22 Thread Mark Lawrence
On 19/02/2015 16:27, Phillip Fleming wrote: In my opinion, Python will not take off like C/C++ if there is no ANSI standard. Python has already taken off because it doesn't have a standard as such. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 22, 2015, at 7:52 AM, Laura Creighton wrote: > In a message of Sun, 22 Feb 2015 07:16:14 -0500, Cem Karan writes: > >> This was PRECISELY the situation I was thinking about. My hope was >> to make the callback mechanism slightly less surprising by allowing >> the user to track them, rel

Re: Future of Pypy?

2015-02-22 Thread Steven D'Aprano
Dave Farrance wrote: > As an engineer, I can quickly knock together behavioural models of > electronic circuits, complete units, and control systems in Python, then > annoyingly in a few recent cases, have to re-write in C for speed. > > I've tried PyPy, the just-in-time compiler for Python, and

Re: Design thought for callbacks

2015-02-22 Thread Marko Rauhamaa
Steven D'Aprano : > I don't know about Java's Hotspot, but I do know that CPython's ref counting > garbage collector has at least one advantage over the GC used by Jython and > IronPython: unlike them, open files are closed as soon as they are no > longer in use. You can't depend on that kind of

Re: Design thought for callbacks

2015-02-22 Thread Chris Angelico
On Mon, Feb 23, 2015 at 12:45 AM, Steven D'Aprano wrote: >> No no no. It's the other way around. _Something_ has to be doing those >> callbacks, and it's that _something_ that should be keeping them >> alive. The fact that it's a registered callback should itself *be* a >> reference (and not a wea

Re: Design thought for callbacks

2015-02-22 Thread Steven D'Aprano
Marko Rauhamaa wrote: > Chris Angelico : > >> On Sun, Feb 22, 2015 at 7:34 PM, Marko Rauhamaa wrote: >>> Refloops are not to be worried about, let alone removed. >> >> Why? > > Because the whole point of GC-languages is that you should stop worrying > about memory. Trying to mastermind and micr

Re: Design thought for callbacks

2015-02-22 Thread Marko Rauhamaa
Cem Karan : > You were saying that you move your objects into a zombie state. I > assumed that you meant you marked them in some manner (e.g., setting > 'is_zombie' to True), Yes, but even better: self.set_state(ZOMBIE) > so that anything that has a strong reference to the object knows th

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 22, 2015, at 7:24 AM, Chris Angelico wrote: > On Sun, Feb 22, 2015 at 11:07 PM, Cem Karan wrote: >>> Correct. The GUI engine ultimately owns everything. Of course, this is >>> a very simple case (imagine a little notification popup; you don't >>> care about it, you don't need to know whe

Re: Design thought for callbacks

2015-02-22 Thread Steven D'Aprano
Chris Angelico wrote: > On Sun, Feb 22, 2015 at 9:32 PM, Steven D'Aprano > wrote: >> Why? Do you expect that the Python garbage collector special cases >> callbacks to keep them alive even when there are no references to them? >> How would it distinguish a callback from some other function? > >

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 22, 2015, at 7:12 AM, Marko Rauhamaa wrote: > Cem Karan : > >> On Feb 21, 2015, at 11:03 AM, Marko Rauhamaa wrote: >>> I use callbacks all the time but haven't had any problems with strong >>> references. >>> >>> I am careful to move my objects to a zombie state after they're done so >

Re: Future of Pypy?

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 12:45:03 +, Dave Farrance writes: >Maybe there's not enough people like me that have really felt the need for >the speed. Or maybe it's simply the accident of the historical >development path that's set-in-stone an interpreter rather than a JIT. >Anybody got a

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 21, 2015, at 3:57 PM, Grant Edwards wrote: > On 2015-02-21, Cem Karan wrote: >> >> On Feb 21, 2015, at 12:42 AM, Chris Angelico wrote: >> >>> On Sat, Feb 21, 2015 at 1:44 PM, Cem Karan wrote: In order to inform users that certain bits of state have changed, I require them

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 21, 2015, at 12:27 PM, Steven D'Aprano wrote: > Cem Karan wrote: > >> >> On Feb 21, 2015, at 8:15 AM, Chris Angelico wrote: >> >>> On Sun, Feb 22, 2015 at 12:13 AM, Cem Karan wrote: OK, so it would violate the principle of least surprise for you. Interesting. Is this a g

Re: Standard

2015-02-22 Thread Skip Montanaro
On Thu, Feb 19, 2015 at 10:27 AM, Phillip Fleming wrote: > In my opinion, Python will not take off like C/C++ if there is no ANSI > standard. On one side of your statement, what makes you think Python ever wanted to "take off like C/C++"? On the other side, there are other languages (Java, PHP, P

Re: Future of Pypy?

2015-02-22 Thread jkn
On Sunday, 22 February 2015 12:45:15 UTC, Dave Farrance wrote: > As an engineer, I can quickly knock together behavioural models of > electronic circuits, complete units, and control systems in Python, then > annoyingly in a few recent cases, have to re-write in C for speed. > > I've tried PyPy,

Re: Design thought for callbacks

2015-02-22 Thread Laura Creighton
In a message of Sun, 22 Feb 2015 07:16:14 -0500, Cem Karan writes: >This was PRECISELY the situation I was thinking about. My hope was >to make the callback mechanism slightly less surprising by allowing >the user to track them, releasing them when they aren't needed >without having to figure out

Re: Design thought for callbacks

2015-02-22 Thread Marko Rauhamaa
Cem Karan : > On Feb 21, 2015, at 12:08 PM, Marko Rauhamaa wrote: >> Maybe the logic of the receiving object isn't prepared for the callback >> anymore after an intervening event. >> >> The problem then, of course, is in the logic and not in the callbacks. > > This was PRECISELY the situation I

Future of Pypy?

2015-02-22 Thread Dave Farrance
As an engineer, I can quickly knock together behavioural models of electronic circuits, complete units, and control systems in Python, then annoyingly in a few recent cases, have to re-write in C for speed. I've tried PyPy, the just-in-time compiler for Python, and that is impressively, hugely fa

Re: Design thought for callbacks

2015-02-22 Thread Chris Angelico
On Sun, Feb 22, 2015 at 11:07 PM, Cem Karan wrote: >> Correct. The GUI engine ultimately owns everything. Of course, this is >> a very simple case (imagine a little notification popup; you don't >> care about it, you don't need to know when it's been closed, the only >> event on it is "hit Close t

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 21, 2015, at 12:08 PM, Marko Rauhamaa wrote: > Steven D'Aprano : > >> Other than that, I cannot see how calling a function which has *not* >> yet been garbage collected can fail, just because the only reference >> still existing is a weak reference. > > Maybe the logic of the receiving

Re: Design thought for callbacks

2015-02-22 Thread Marko Rauhamaa
Cem Karan : > On Feb 21, 2015, at 11:03 AM, Marko Rauhamaa wrote: >> I use callbacks all the time but haven't had any problems with strong >> references. >> >> I am careful to move my objects to a zombie state after they're done so >> they can absorb any potential loose callbacks that are linger

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 21, 2015, at 11:03 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Sat, Feb 21, 2015 at 1:44 PM, Cem Karan wrote: > >>> In order to inform users that certain bits of state have changed, I >>> require them to register a callback with my code. The problem is that >>> when I store th

Re: Design thought for callbacks

2015-02-22 Thread Cem Karan
On Feb 21, 2015, at 10:55 AM, Chris Angelico wrote: > On Sun, Feb 22, 2015 at 2:45 AM, Cem Karan wrote: >> OK, so if I'm reading your code correctly, you're breaking the cycle in your >> object graph by making the GUI the owner of the callback, correct? No other >> chunk of code has a refere

Re: pypandoc and restructured text

2015-02-22 Thread Fabien
On 22.02.2015 00:20, alb wrote: I finally upgraded! And I'm currently trying out xfce! Thanks again for the suggestions. Al p.s.: now pandoc works as expected. I don't want to sound insistent, but as a Linux user I personnaly recommend not to use "apt" to install and use python packages. Ins

Re: Design thought for callbacks

2015-02-22 Thread Laura Creighton
somebody, I got confused with the indent level wrote: >> They force the use of the much slower cycle-detecting GC, rather than >> the quick and efficient CPython refcounter. Somebody has misunderstood something here. When it comes to efficient garbage collectors, refcounting is a turtle. The CP

Re: Design thought for callbacks

2015-02-22 Thread Chris Angelico
On Sun, Feb 22, 2015 at 9:32 PM, Steven D'Aprano wrote: > Why? Do you expect that the Python garbage collector special cases callbacks > to keep them alive even when there are no references to them? How would it > distinguish a callback from some other function? No no no. It's the other way aroun

About GSOC 2015

2015-02-22 Thread Nadeesh Dilanga
Hi, I'm a Computer Science undergraduate student who like to participate in GSOC this year. Do you have any projects willing to publish for gsoc 2015. I am more familiar with Python. -- https://mail.python.org/mailman/listinfo/python-list

Re: What behavior would you expect?

2015-02-22 Thread Jason Friedman
> If you're going to call listdir, you probably want to use fnmatch directly. > > fnmatch seems to be silent on non-existent directories: python -c 'import fnmatch; fnmatch.fnmatch("/no/such/path", "*")' -- https://mail.python.org/mailman/listinfo/python-list

  1   2   >