Re: Not understanding lamdas and scoping

2008-03-26 Thread George Sakkis
On Mar 26, 5:02 pm, Joshua Kugler <[EMAIL PROTECTED]> wrote: > I am trying to use lamdba to generate some functions, and it is not working > the way I'd expect. The code is below, followed by the results I'm > getting. More comments below that. > > (...) > > So, is there some scoping issue with

Line segments, overlap, and bits

2008-03-26 Thread Sean Davis
I am working with genomic data. Basically, it consists of many tuples of (start,end) on a line. I would like to convert these tuples of (start,end) to a string of bits where a bit is 1 if it is covered by any of the regions described by the (start,end) tuples and 0 if it is not. I then want to d

Re: _tkinter fails when installing Python 2.4.4

2008-03-26 Thread Diez B. Roggisch
jgelfand schrieb: > On Mar 26, 7:02 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> I think the actual problem is that the linking doesn't find the >> XftGlyphExtends. I can only guess, but it might be related to >> 64-bit-problems. Make sure you have the library that contains the >> XftGlyphE

RE: Do any of you recommend Python as a first programming language?

2008-03-26 Thread Carnell, James E
I vote a strong yes! I went through a MIS major and learned java first. This was a disaster for me typing these long nonsense lines (I didn't understand how classes and their members worked). Next was C and we had to use a command line and notepad to do all our programs. I really didn't learn much

Newbie: unsigned shift right

2008-03-26 Thread Sal
Is there any way to do an unsigned shift right in Python? When I enter (-1>>1) the answer is -1. What I'm looking for is the equivalent of an unsigned shift in C or the ">>>" operator in Java. -- http://mail.python.org/mailman/listinfo/python-list

Re: py2exe socket.gaierror (10093)

2008-03-26 Thread Knut
> The script can't resolve the server name. Try to do it by hand using > nslookup or even ping (you may want to add a few print statements inside > the script to see the exact host name it is trying to connect to, in case > it isn't what you expect) > If you can't resolve the host name using nslook

Re: Not understanding lamdas and scoping

2008-03-26 Thread Joshua Kugler
George Sakkis wrote: > On Mar 26, 5:02 pm, Joshua Kugler <[EMAIL PROTECTED]> wrote: > >> I am trying to use lamdba to generate some functions, and it is not >> working >> the way I'd expect. The code is below, followed by the results I'm >> getting. More comments below that. >> >> (...) >> >> S

Why does python behave so? (removing list items)

2008-03-26 Thread Michał Bentkowski
Why does python create a reference here, not just copy the variable? >>> j=range(0,6) >>> k=j >>> del j[0] >>> j [1, 2, 3, 4, 5] >>> k [1, 2, 3, 4, 5] Shouldn't k remain the same? -- Michał Bentkowski [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: unsigned shift right

2008-03-26 Thread Mark Dickinson
On Mar 26, 5:42 pm, Sal <[EMAIL PROTECTED]> wrote: > Is there any way to do an unsigned shift right in Python? When I enter > (-1>>1) the answer is -1. What I'm looking for is the equivalent of an > unsigned shift in C or the ">>>" operator in Java. What answer were you hoping for, and why? 2**31

Re: py2exe socket.gaierror (10093)

2008-03-26 Thread Thomas Heller
Knut schrieb: >> The script can't resolve the server name. Try to do it by hand using >> nslookup or even ping (you may want to add a few print statements inside >> the script to see the exact host name it is trying to connect to, in case >> it isn't what you expect) >> If you can't resolve the hos

Re: Why does python behave so? (removing list items)

2008-03-26 Thread Thomas Dybdahl Ahle
On Wed, 2008-03-26 at 23:04 +0100, Michał Bentkowski wrote: > Why does python create a reference here, not just copy the variable? Python, like most other oo languages, will always make references for =, unless you work on native types (numbers and strings). Instead use one of: k = j[:] or k = [

Re: Line segments, overlap, and bits

2008-03-26 Thread bearophileHUGS
Sean Davis>Java has a BitSet class that keeps this kind of thing pretty clean and high-level, but I haven't seen anything like it for python.< If you look around you can usually find Python code able to do most of the things you want, like (you can modify this code to add the boolean operations):

Re: first interactive app

2008-03-26 Thread Miki
Hello Tim, > I want to write a tiny interactive app for the following situation: > I have books of many chapters that must be split into volumes before going > to the printer. > A volume can have up to 600 pages. We obviously break the book into volumes > only at chapter breaks. Since some chapter

Re: Why does python behave so? (removing list items)

2008-03-26 Thread Waldemar Osuch
On Mar 26, 4:04 pm, "Michał Bentkowski" <[EMAIL PROTECTED]> wrote: > Why does python create a reference here, not just copy the variable? > > >>> j=range(0,6) > >>> k=j > >>> del j[0] > >>> j > [1, 2, 3, 4, 5] > >>> k > > [1, 2, 3, 4, 5] > > Shouldn't k remain the same? http://www.effbot.org/zone/

Re: Why does python behave so? (removing list items)

2008-03-26 Thread Jarek Zgoda
Michał Bentkowski pisze: > Why does python create a reference here, not just copy the variable? Because Python works like that -- it uses names and values idiom. If you change value, all names will be bound to the same changed value. j=range(0,6) k=j del j[0] j > [1, 2, 3, 4,

Re: Why does python behave so? (removing list items)

2008-03-26 Thread Dan Bishop
On Mar 26, 5:12 pm, Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote: > On Wed, 2008-03-26 at 23:04 +0100, Michał Bentkowski wrote: > > Why does python create a reference here, not just copy the variable? > > Python, like most other oo languages, will always make references for =, > unless you work on

Re: Filtering a Python list to uniques

2008-03-26 Thread Gabriel Genellina
En Wed, 26 Mar 2008 15:50:30 -0300, kellygreer1 <[EMAIL PROTECTED]> escribió: > On Mar 26, 5:45 am, hellt <[EMAIL PROTECTED]> wrote: >> On 26 ÍÁÒ, 02:30,kellygreer1<[EMAIL PROTECTED]> wrote: >> >> > What is the best way to filter a Python list to its unique members? > How come the Set() thing s

Re: memory allocation for Python list

2008-03-26 Thread bearophileHUGS
dmitrey: > As I have mentioned, I don't know final length of the list, but > usually I know a good approximation, for example 400. You may want to use collections.deque too, it doesn't produce a Python list, but it's quite fast in appending (it's a linked list of small arrays). Bye, bearophile --

Re: Why does python behave so? (removing list items)

2008-03-26 Thread bearophileHUGS
Michał Bentkowski: > Why does python create a reference here, not just copy the variable? I think to increase performance, in memory used and running time (and to have a very uniform way of managing objects). Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: A question on decorators

2008-03-26 Thread castironpi
On Mar 26, 3:23 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Tim Henderson schrieb: > > > > > > > Hello > > > I am writing an application that has a mysql back end and I have this > > idea to simplify my life when accessing the database. The idea is to > > wrap the all the functions dealing

Re: A question on decorators

2008-03-26 Thread Gabriel Genellina
En Wed, 26 Mar 2008 18:01:31 -0300, George Sakkis <[EMAIL PROTECTED]> escribió: > On Mar 26, 3:41 pm, Tim Henderson <[EMAIL PROTECTED]> wrote: > >> I am using mysql, and sqlite is not appropriate for my situation since >> some of the databases and tables I access are being accessed by other >> a

Re: what does ^ do in python

2008-03-26 Thread Gabriel Genellina
En Wed, 26 Mar 2008 16:14:07 -0300, David Anderson <[EMAIL PROTECTED]> escribió: > The right question was:HOw can we use/express pointers python as in C or > Pascal? I think you should read this article: http://effbot.org/zone/python-objects.htm and then: http://effbot.org/zone/call-by-object

Re: How to convert latex-based docs written with Python 2.5 to 2.6 framework

2008-03-26 Thread Gabriel Genellina
En Wed, 26 Mar 2008 16:37:21 -0300, Michael Ströder <[EMAIL PROTECTED]> escribió: > I had a look on how Doc/ is organized with Python 2.6. There are files > with > suffix .rst. Hmm... > > I'm maintaing existing docs for python-ldap which I might have to > convert to > the new concept in the

subtract dates with time module

2008-03-26 Thread barronmo
I'm trying to get the difference in dates using the time module rather than datetime because I need to use strptime() to convert a date and then find out how many weeks and days until that date. I'm a beginner so any help would be appreciated. Here is the code: def OBweeks(ptID): qry = 'SEL

Re: Some notes on a high-performance Python application.

2008-03-26 Thread John Nagle
Heiko Wundram wrote: > Am Mittwoch, 26. März 2008 18:54:29 schrieb Michael Ströder: >> Heiko Wundram wrote: >>> Am Mittwoch, 26. März 2008 17:33:43 schrieb John Nagle: > I didn't say it was unusual or frowned upon (and I was also taught this at > uni > IIRC as a means to "easily" distribute syst

Re: Python 2.2.1 and select()

2008-03-26 Thread Derek Martin
On Wed, Mar 26, 2008 at 09:49:51AM -0700, Noah Spurrier wrote: > On 2008-03-24 22:03-0400, Derek Martin wrote: > >That's an interesting thought, but I guess I'd need you to elaborate > >on how the buffering mode would affect the operation of select(). I > >really don't see how your explanation can

Re: subtract dates with time module

2008-03-26 Thread Gabriel Genellina
En Wed, 26 Mar 2008 20:47:45 -0300, barronmo <[EMAIL PROTECTED]> escribió: > I'm trying to get the difference in dates using the time module rather > than datetime because I need to use strptime() to convert a date and > then find out how many weeks and days until that date. I'm a beginner > so a

Re: Daylight savings time problem

2008-03-26 Thread Salsa
Yeah, I guess it would, but it doesn't feel like the "right" way to do it. Isn't there a way I can set tm_isdst to "-1"? Or at least slice the time_struct and then add another element to its end when passing it to mktime? Thanks for all your help! --- "D'Arcy J.M. Cain" <[EMAIL PROTECTED]>

Re: A question on decorators

2008-03-26 Thread castironpi
On Mar 26, 6:02 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 26 Mar 2008 18:01:31 -0300, George Sakkis   > <[EMAIL PROTECTED]> escribió: > > > On Mar 26, 3:41 pm, Tim Henderson <[EMAIL PROTECTED]> wrote: > > >> I am using mysql, and sqlite is not appropriate for my situation since >

Re: Not understanding lamdas and scoping

2008-03-26 Thread George Sakkis
On Mar 26, 6:03 pm, Joshua Kugler <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > On Mar 26, 5:02 pm, Joshua Kugler <[EMAIL PROTECTED]> wrote: > > >> I am trying to use lamdba to generate some functions, and it is not > >> working > >> the way I'd expect. The code is below, followed by the r

Re: Why does python behave so? (removing list items)

2008-03-26 Thread castironpi
On Mar 26, 5:28 pm, [EMAIL PROTECTED] wrote: > Micha³ Bentkowski: > > > Why does python create a reference here, not just copy the variable? > > I think to increase performance, in memory used and running time (and > to have a very uniform way of managing objects). > > Bye, > bearophile A variable

Re: Line segments, overlap, and bits

2008-03-26 Thread castironpi
On Mar 26, 5:10 pm, [EMAIL PROTECTED] wrote: > Sean Davis>Java has a BitSet class that keeps this kind of thing > pretty clean and high-level, but I haven't seen anything like it for > python.< > > If you look around you can usually find Python code able to do most of > the things you want, like (y

[ANN] Twisted 8.0

2008-03-26 Thread Christopher Armstrong
http://twistedmatrix.com/ MASSACHUSETTS (DP) -- Version 8.0 of the Twisted networking framework has been released, Twisted Matrix Laboratories announced Wednesday. Enslaved by his new robotic overloads, Master of the Release Christopher Armstrong presented the new package to the Internet on March

Re: Line segments, overlap, and bits

2008-03-26 Thread George Sakkis
On Mar 26, 5:28 pm, Sean Davis <[EMAIL PROTECTED]> wrote: > I am working with genomic data. Basically, it consists of many tuples > of (start,end) on a line. I would like to convert these tuples of > (start,end) to a string of bits where a bit is 1 if it is covered by > any of the regions describ

Re: first interactive app

2008-03-26 Thread castironpi
On Mar 26, 5:11 pm, Miki <[EMAIL PROTECTED]> wrote: > Hello Tim, > > > > > > > I want to write a tiny interactive app for the following situation: > > I have books of many chapters that must be split into volumes before going > > to the printer. > > A volume can have up to 600 pages. We obviously b

Re: Not understanding lamdas and scoping

2008-03-26 Thread castironpi
On Mar 26, 5:03 pm, Joshua Kugler <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > On Mar 26, 5:02 pm, Joshua Kugler <[EMAIL PROTECTED]> wrote: > > >> I am trying to use lamdba to generate some functions, and it is not > >> working > >> the way I'd expect.  The code is below, followed by the r

Re: Line segments, overlap, and bits

2008-03-26 Thread Paul Rubin
Sean Davis <[EMAIL PROTECTED]> writes: > OR, NOT, etc.). Any suggestions on how to (1) set up the bit string > and (2) operate on 1 or more of them? Java has a BitSet class that > keeps this kind of thing pretty clean and high-level, but I haven't > seen anything like it for python. You could wr

genetic algors in practical application

2008-03-26 Thread castironpi
I want to go in to construction. However, 'I' means 'newsgroup' and 'want to go' means 'is'. If you had an army of two-micron spiders, could we build something? Use case is an American skyscraper. They have powerful tricks. Clearly they can withstand a force. These can withstand more combined,

Re: A question on decorators

2008-03-26 Thread alex23
On Mar 27, 8:30 am, [EMAIL PROTECTED] wrote: > I want the * to precede the dot too. Let's yack. I want to compile > Python. Did you see my new post? I like it. Do you have any time > you don't want? Time sale. Diez is still mad at me. I want > primitives to structure themselves so I can pic

Can my own objects support tuple unpacking?

2008-03-26 Thread Patrick Toomey
Hello, So, I am new to python, but I always like to learn the ins and outs of a language by trying to understand how everything fits together. Anyway, I am trying to figure out how tuple unpacking behavior works. Specifically, what happens when I do the following: a,b,c,d = e Is a meth

Re: Why does python behave so? (removing list items)

2008-03-26 Thread Steven D'Aprano
On Wed, 26 Mar 2008 23:12:27 +0100, Thomas Dybdahl Ahle wrote: > On Wed, 2008-03-26 at 23:04 +0100, Michał Bentkowski wrote: >> Why does python create a reference here, not just copy the variable? > > Python, like most other oo languages, will always make references for =, > unless you work on na

Re: Why does python behave so? (removing list items)

2008-03-26 Thread Carl Banks
On Mar 26, 11:30 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Wed, 26 Mar 2008 23:12:27 +0100, Thomas Dybdahl Ahle wrote: > > On Wed, 2008-03-26 at 23:04 +0100, Michał Bentkowski wrote: > >> Why does python create a reference here, not just copy the variable? > > > Python,

Re: Can my own objects support tuple unpacking?

2008-03-26 Thread Scott David Daniels
Patrick Toomey wrote: > ... I am trying to figure out how tuple unpacking behavior works > a,b,c,d = e > > Is a method called, such as __getitem__ for each index on the left > (0,1,2,3)? I thought this was logical, ... > > class Foo: > def __getitem__(self, index): > print index >

copy file over LAN

2008-03-26 Thread Astan Chee
Hi, I have a file on another machine on the local network (my machine and local machines are on windows) and I want to copy it locally. Now the machine requires authentication and when I try to do a import shutil shutil.copy(r'\\remotemachine\c$\temp\filename',r'C:\folder\test.txt') and it gives

Re: SoC project: Python-Haskell bridge - request for feedback

2008-03-26 Thread Michał Janeczek
Thanks for finding time to reply! On 26 Mar 2008 01:46:38 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > A few thoughts. The envisioned Python-Haskell bridge would have two > directions: 1) calling Haskell code from Python; 2) calling Python > code from Haskell. The proposal spend

Plugin framework - Overcomplicating things?

2008-03-26 Thread [EMAIL PROTECTED]
As a side project and a learning experience and ultimately, a good tool for my department, I started developing a simple jabber bot for our work's conference server, with the intention of making it capable of running specific commands and utilities. I realize there are other bots out there, but I

Re: SoC project: Python-Haskell bridge - request for feedback

2008-03-26 Thread Michał Janeczek
Hi, This is my second take on the project proposal. I have expanded on a few points, and hopefully also clarified a little bit. Please comment :) Regards, Michal Python-Haskell bridge = Description --- This project will seek to provide a comprehensive, high level

Re: last mouse movment or keyboard hit

2008-03-26 Thread Ron Eggler
azrael wrote: > You can use wxPython. Take a look on the DemoFiles that you can > download also from the site. I remember that there has been a demo of > capturing mouse coordinates and also one example about capturing Which > key has been pressed at which time. > Just start the time, count the in

Re: last mouse movment or keyboard hit

2008-03-26 Thread Ron Eggler
Gabriel Genellina wrote: >>> En Wed, 26 Mar 2008 00:38:08 -0300, Ron Eggler <[EMAIL PROTECTED]> >>> escribió: >>> >>> >> I would like to get the time of the most recent human activity like a >>> >> cursor >>> >> movement or a key hit. >>> >> Does anyone know how I can get this back to start some a

Re: A question on decorators

2008-03-26 Thread castironpi
On Mar 26, 10:02 pm, alex23 <[EMAIL PROTECTED]> wrote: > On Mar 27, 8:30 am, [EMAIL PROTECTED] wrote: > > > I want the * to precede the dot too.  Let's yack.  I want to compile > > Python.  Did you see my new post?  I like it.  Do you have any time > > you don't want?  Time sale.  Diez is still mad

Re: subprocess.popen function with quotes

2008-03-26 Thread skunkwerk
On Mar 26, 8:05 am, Jeffrey Froman <[EMAIL PROTECTED]> wrote: > skunkwerk wrote: > > p = subprocess.Popen(['rename','-vn','s/(.*)\.htm$/ > > model.html/','*.htm'],stdout=subprocess.PIPE,stderr=subprocess.PIPE) > > print p.communicate()[0] > > > i change to print p.communicate()[1] in case the outpu

Re: parsing json output

2008-03-26 Thread Gowri
Hi all, Thank you so much for all your help :) I really appreciate it. I discovered that my problem was because of my firewall and everything works now :) Regards, Gowri -- http://mail.python.org/mailman/listinfo/python-list

Re: copy file over LAN

2008-03-26 Thread Teja
On Mar 27, 8:34 am, Astan Chee <[EMAIL PROTECTED]> wrote: > Hi, > I have afileon another machine on the localnetwork(my machine and > local machines are on windows) and I want tocopyit locally. Now the > machine requires authentication and when I try to do a > import shutil > shutil.copy(r'\\remote

Re: GUI toolkits with Tkinter's .pack() alternative

2008-03-26 Thread Alex9968
Guilherme Polo wrote: > 2008/3/26, Alex9968 <[EMAIL PROTECTED]>: > >> Hi all, >> >> I use Tkinter's Pack widget geometry manager (I really prefer it over >> using visual GUI designers), so my question is which other GUI toolkits >> have similar functionality. >> > > The geometry manager

Re: Line segments, overlap, and bits

2008-03-26 Thread castironpi
On Mar 26, 9:16 pm, Paul Rubin wrote: > Sean Davis <[EMAIL PROTECTED]> writes: > > OR, NOT, etc.).  Any suggestions on how to (1) set up the bit string > > and (2) operate on 1 or more of them?  Java has a BitSet class that > > keeps this kind of thing pretty clean and hi

Re: copy file over LAN

2008-03-26 Thread Gabriel Genellina
En Thu, 27 Mar 2008 00:34:20 -0300, Astan Chee <[EMAIL PROTECTED]> escribió: > I have a file on another machine on the local network (my machine and > local machines are on windows) and I want to copy it locally. Now the > machine requires authentication and when I try to do a > import shutil > sh

Re: copy file over LAN

2008-03-26 Thread Astan Chee
Well, the solution seems to be something like (windows only) import os import os.path import shutil import sys import win32wnet def wnet_connect(host, username, password): unc = ''.join(['', host]) try: win32wnet.WNetAddConnection2(0, None, unc, None, username, password) excep

counting using variable length string as base

2008-03-26 Thread Grimsqueaker
Hi, I'm fairly new to Python and to this list. I have a problem that is driving me insane, sorry if it seems simple to everyone, I've been fighting with it for a while. :)) I want to take a variable length string and use it as a base for counting, eg. given the string 'abc' the sequence would be:

Re: Python 2.2.1 and select()

2008-03-26 Thread Derek Martin
On Wed, Mar 26, 2008 at 07:11:15PM -0700, Noah Spurrier wrote: > >def set_nonblock(fd): > > flags = fcntl.fcntl(fd, fcntl.F_GETFL) > > fcntl.fcntl(fd, fcntl.F_SETFL, flags | os.O_NONBLOCK) > > > >Then in the function, after calling popen: > > set_nonblock(io.fromchild.fileno()) > >

Re: counting using variable length string as base

2008-03-26 Thread Dan Bishop
On Mar 27, 1:15 am, Grimsqueaker <[EMAIL PROTECTED]> wrote: > Hi, I'm fairly new to Python and to this list. I have a problem that > is driving me insane, sorry if it seems simple to everyone, I've been > fighting with it for a while. :)) > > I want to take a variable length string and use it as a

Re: Plugin framework - Overcomplicating things?

2008-03-26 Thread Gabriel Genellina
En Thu, 27 Mar 2008 01:50:56 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > All this comes to my question - am I overcomplicating this project? I > can understand the use of something like the trac component system if > I had multiple components and plugins that handled different areas

<    1   2