iterator clone

2008-07-12 Thread Yosifov Pavel
Whats is the way to clone "independent" iterator? I can't use tee(), because I don't know how many "independent" iterators I need. copy and deepcopy doesn't work... --pavel -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird lambda rebinding/reassignment without me doing it

2008-07-12 Thread Steven D'Aprano
On Sat, 12 Jul 2008 16:32:25 -0400, Terry Reedy wrote: > Steven D'Aprano wrote: >> On Thu, 10 Jul 2008 14:09:16 -0400, Terry Reedy wrote: >> g = lambda x:validate(x) >>> This is doubly diseased. >>> >>> First, never write a 'name = lambda...' statement since it is >>> equivalent to a def

Re: spam <...googlegroups.com> <...googlegroups.com>

2008-07-12 Thread JeffM
>WDC wrote: >>BTW I reported it, yo should too. >> Lew wrote: >To whom did you report it, so that we may also report it there? Reports made to Google Groups are a complete waste of time. Google will only cancel *that* account (without blocking the IP address). It takes the spammer 30 seconds to en

Re: filtering keyword arguments

2008-07-12 Thread bukzor
On Jul 12, 8:44 pm, Amir <[EMAIL PROTECTED]> wrote: > How do you filter keyword arguments before passing them to a function? > > For example: > > def f(x=1): return x > > def g(a, **kwargs): print a, f(**kwargs) > > In [5]: g(1, x=3) > 1 3 > > In [6]: g(1, x=3, y=4) > TypeError: f() got an unexpect

Re: filtering keyword arguments

2008-07-12 Thread Peter Otten
Amir wrote: > How do you filter keyword arguments before passing them to a function? > > For example: > > def f(x=1): return x > > def g(a, **kwargs): print a, f(**kwargs) > > In [5]: g(1, x=3) > 1 3 > > In [6]: g(1, x=3, y=4) > TypeError: f() got an unexpected keyword argument 'y' > > Is th

Re: filtering keyword arguments

2008-07-12 Thread [EMAIL PROTECTED]
On Jul 12, 10:44 pm, Amir <[EMAIL PROTECTED]> wrote: > How do you filter keyword arguments before passing them to a function? > > For example: > > def f(x=1): return x > > def g(a, **kwargs): print a, f(**kwargs) > > In [5]: g(1, x=3) > 1 3 > > In [6]: g(1, x=3, y=4) > TypeError: f() got an unexpec

Re: Determining when a file has finished copying

2008-07-12 Thread Larry Bates
Sean DiZazzo wrote: On Jul 9, 5:34 pm, keith <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ethan Furman wrote: writeson wrote: Guys, Thanks for your replies, they are helpful. I should have included in my initial question that I don't have as much control over the

Re: spam <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

2008-07-12 Thread Lew
WDC wrote: BTW I reported it, yo should too. To whom did you report it, so that we may also report it there? -- Lew -- http://mail.python.org/mailman/listinfo/python-list

filtering keyword arguments

2008-07-12 Thread Amir
How do you filter keyword arguments before passing them to a function? For example: def f(x=1): return x def g(a, **kwargs): print a, f(**kwargs) In [5]: g(1, x=3) 1 3 In [6]: g(1, x=3, y=4) TypeError: f() got an unexpected keyword argument 'y' Is there a way to do something like: def g(a, *

socket.connect() hangs in SYN_SENT state.

2008-07-12 Thread bukzor
I'm having an issue where my program hangs while doing socket.connect() for a couple minutes, then times out the connection and crashes. I'm connecting to an apache2 process on the same machine, for testing. When looking at netstat, the socket is in the SYN_SENT state, like this: $netstat -a -tcp

Re: How to create a timer/scheduler in Python?

2008-07-12 Thread MrJean1
There is a module called sched in the standard Python library /Jean Brouwers John Dann wrote: > I need what I'd call (in .Net) a timer, ie I need to run a function eg > every 2 seconds - it doesn't need to be millisec accurate but it would > be

Re: Someone enlightened me

2008-07-12 Thread bukzor
On Jul 12, 7:08 pm, Marcus Low <[EMAIL PROTECTED]> wrote: > Can someone explain to me, why the behaviour below is different when u > remark "lister" and unremark "self.lister"? > > #-- > class abc : > # remark this later and unremark "

New TTF fonts in IDLE on Linux question

2008-07-12 Thread [EMAIL PROTECTED]
So I'm using this Akbar font, a truetype, related to Simpsons, for coding in Python, just for kicks (looks pretty good actually). No prob on Windows, but when I sudo cp akbar.ttf to /usr/share/fonts/ truetype/ttf-misc, a directory I made myself (root root), then OpenOffice and WingWare find it rig

Re: Why is there no GUI-tools like this for Windows?

2008-07-12 Thread Marcus.CM
Hi, Coming from a windows world i could understand this. For GUI, there is nothing near the power of the Visual Studio, this is especially true since C#. So python for me is for anything except GUI. It becomes self rejecting notion to do GUI in python when you type in those stuff that could ha

Re: Correct use of try,except and raise?

2008-07-12 Thread Ben Finney
ssecorp <[EMAIL PROTECTED]> writes: > Is this correct use of exceptions? to raise an indexerror and add my > own string insetad of just letting it raise a IndexError by itself > and "blaming" it on list.pop? > > class Stack(object): > def __init__(self, *items): > self.stack = list(it

Someone enlightened me

2008-07-12 Thread Marcus Low
Can someone explain to me, why the behaviour below is different when u remark "lister" and unremark "self.lister"? #-- class abc : # remark this later and unremark "self.lister" lister = [] def __init__ (self, val): #se

Someone enlightened me

2008-07-12 Thread Marcus Low
Opps here is the mail again, incase my formatting is lost, can someone explain to me why this code behaves differently when "lister" and "self.lister" is swap remarked. class abc : # remark this later and unremark "self.lister" lister = [] def __init__ (self, val): #self.lister

Re: Someone enlightened me

2008-07-12 Thread Marcus Low
Duh, Ok here is the file again ...attached. I give up doing this via the email editor. Sorry! new to the mailing list. Marcus Marcus Low wrote: Opps here is the mail again, incase my formatting is lost, can someone explain to me why this code behaves differently when "lister" and "self.list

Re: palindrome function

2008-07-12 Thread Terry Reedy
Mensanator wrote: It hasn't. and here's why: IDLE 2.6b1 seq=['a','n','n','a'] seq.reversed() Traceback (most recent call last): File "", line 1, in seq.reversed() AttributeError: 'list' object has no attribute 'reversed' My apologies. reversed() is a builtin func, not a method, a

Re: Correct use of try,except and raise?

2008-07-12 Thread Roy Smith
ssecorp <[EMAIL PROTECTED]> wrote: > i dont get what you mean, if i dont do anything python will raise an > indexerror so it is an indexerror. You wrote: > > >     def pop(self): > > >         try: > > >             return self.queue.pop(0) > > >         except: > > >             raise IndexErro

Re: Correct use of try,except and raise?

2008-07-12 Thread ssecorp
On Jul 13, 2:32 am, Roy Smith <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > > > >  ssecorp <[EMAIL PROTECTED]> wrote: > > Is this correct use of exceptions? to raise an indexerror and add my > > own string insetad of just letting it raise a IndexError by itself and > > "blaming"

Problems with curses

2008-07-12 Thread Clay Hobbs
I am making a text-based game similar to Zork with Python. I have decided to use the curses module, and have run into a problem. I want to scroll the commands and output up after a command is run instead of clearing the screen. But when I use std.scroll(), an exception is raised. Here i

Re: Correct use of try,except and raise?

2008-07-12 Thread Roy Smith
In article <[EMAIL PROTECTED]>, ssecorp <[EMAIL PROTECTED]> wrote: > Is this correct use of exceptions? to raise an indexerror and add my > own string insetad of just letting it raise a IndexError by itself and > "blaming" it on list.pop? > > class Stack(object): > def __init__(self, *items

Re: Beginner Question : Iterators and zip

2008-07-12 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Hi group, I have a basic question on the zip built in function. I am writing a simple text file comparison script, that compares line by line and character by character. The output is the original file, with an X in place of any characters that are different. I have

Re: Why is there no GUI-tools like this for Windows?

2008-07-12 Thread Stef Mientki
maestro wrote: http://www.youtube.com/watch?v=PXpwC1o5AcI I have done some GUI-programming for windows with Python but the Tkinter interface sucked and while it is the only one I tried I got the impression they are all the same. It's amazing how retarded a lot of the stuff programmers do is. Wa

Correct use of try,except and raise?

2008-07-12 Thread ssecorp
Is this correct use of exceptions? to raise an indexerror and add my own string insetad of just letting it raise a IndexError by itself and "blaming" it on list.pop? class Stack(object): def __init__(self, *items): self.stack = list(items) def push(self, item): self.stack.

Re: Why is this blowing the stack, thought it was tail-recursive...

2008-07-12 Thread Terry Reedy
ssecorp wrote: def fib(n): def fibt(a, b, n): if n <= 1: return b else: return fibt(b, a + b, n - 1) if n == 0: return 0 else: return fibt(0, 1, n); and can memoization speed up this even more? tesintg with memoization doesnt

Re: like py2exe, but on a mac

2008-07-12 Thread Alexnb
Python.Arno wrote: > > > On 13 jul 2008, at 00:39, Alexnb wrote: > >> >> Hi All >> >> I am wondering what I can do to turn a python app (.py) into a mac OSX >> applicaiton (.app). Just like py2exe does. > > i use these: > http://undefined.org/python/py2app.html > http://effbot.org/pyfaq/how-

Re: like py2exe, but on a mac

2008-07-12 Thread Python.Arno
On 13 jul 2008, at 00:39, Alexnb wrote: Hi All I am wondering what I can do to turn a python app (.py) into a mac OSX applicaiton (.app). Just like py2exe does. i use these: http://undefined.org/python/py2app.html http://effbot.org/pyfaq/how-do-i-create-a-pyc-file.htm But I am also wonder

like py2exe, but on a mac

2008-07-12 Thread Alexnb
Hi All I am wondering what I can do to turn a python app (.py) into a mac OSX applicaiton (.app). Just like py2exe does. But I am also wondering since in your applications folder on macs it usually doesn't have an actual folder for each app. Rather an icon. so for firefox, you just see the icon.

Re: heapq question

2008-07-12 Thread bearophileHUGS
Giampaolo Rodola': > Even if I avoid to re-heapify() it seems that the first element > returned by heappop() is always the smaller one. Yes, the heappop() function keeps the heap invariant, so it will keep giving you the smallest item. > I'd like to understand if there are cases where > deleting

Re: Why is there no GUI-tools like this for Windows?

2008-07-12 Thread Guilherme Polo
On Sat, Jul 12, 2008 at 6:35 PM, maestro <[EMAIL PROTECTED]> wrote: > http://www.youtube.com/watch?v=PXpwC1o5AcI > > I have done some GUI-programming for windows with Python but the > Tkinter interface sucked and while it is the only one I tried I got > the impression they are all the same. > > It'

Why is there no GUI-tools like this for Windows?

2008-07-12 Thread maestro
http://www.youtube.com/watch?v=PXpwC1o5AcI I have done some GUI-programming for windows with Python but the Tkinter interface sucked and while it is the only one I tried I got the impression they are all the same. It's amazing how retarded a lot of the stuff programmers do is. Watcing that video,

Re: Weird lambda rebinding/reassignment without me doing it

2008-07-12 Thread Terry Reedy
Steven D'Aprano wrote: On Thu, 10 Jul 2008 14:09:16 -0400, Terry Reedy wrote: g = lambda x:validate(x) This is doubly diseased. First, never write a 'name = lambda...' statement since it is equivalent to a def statement except that the resulting function object lacks a proper .funcname attr

Re: why is "self" used in OO-Python?

2008-07-12 Thread ssecorp
On Jul 12, 8:44 pm, castironpi <[EMAIL PROTECTED]> wrote: > On Jul 12, 1:01 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > > > > > ssecorp <[EMAIL PROTECTED]> wrote: > > > 1. Why do I have to pass self into every method in a class? Since I am > > > always doing why cant this be automated or abstract

Re: Beginner Question : Iterators and zip

2008-07-12 Thread [EMAIL PROTECTED]
On 12 juil, 20:55, [EMAIL PROTECTED] wrote: > Hi group, > > I have a basic question on the zip built in function. > > I am writing a simple text file comparison script, that compares line > by line and character by character. The output is the original file, > with an X in place of any characters t

Re: Confused

2008-07-12 Thread Terry Reedy
Michael Torrie wrote: eric.butteriss wrote: Please tell me why may mail is being returned. The message says I have been blacklisted...for what reason? I never open mail that I know is not expected and I never send junk or spam. I am trying to send important info to my cousin. Now I'm confuse

Re: Help with BeautifulSoup

2008-07-12 Thread Alexnb
Michiel Overtoom wrote: > > Alex wrote... >> >>Okay, heres the general idea of the html I have to work with: >> >> >> noun >> >> >> >> >> verb >> >> >> >> >> >>Okay, I left off some stuff. > > I wish you didn't, or at least provided an URL where I can get the page > w

Re: why is "self" used in OO-Python?

2008-07-12 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Duncan Booth <[EMAIL PROTECTED]> wrote: > Sadly a lot of Java programmers mistake the limitations of their language > for rules of OO programming, and worse this has spread from Java into other > languages where these restrictions no longer need apply. You can g

Re: Changing self: if self is a tree how to set to a different self

2008-07-12 Thread Terry Reedy
Kay Schluehr wrote: Since it is acting on a tree why doesn't the code substitute self in its parent by SS? That's the natural perspective if one considers a tree as a linked structure and inserts and deletes nodes within this structure. I think you are suggesting the same thing I did: > If

Re: palindrome function

2008-07-12 Thread Mensanator
On Jul 12, 2:18�pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Peter Otten wrote: > > Denis Kasak wrote: > > >> Basically, it reverses the list in place, so it modifies the list which > >> called it. It does not return a /new/ list which is a reversed version > >> of the original, as you expected it

Re: Beginner Question : Iterators and zip

2008-07-12 Thread Larry Bates
[EMAIL PROTECTED] wrote: Hi group, I have a basic question on the zip built in function. I am writing a simple text file comparison script, that compares line by line and character by character. The output is the original file, with an X in place of any characters that are different. I have ma

Re: Doubts about how implementing asynchronous timeouts through a heap

2008-07-12 Thread Josiah Carlson
On Jul 9, 4:13 am, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > Hi, > I'm trying to implement an asynchronous scheduler for asyncore to call > functions at a later time without blocking the main loop. > The logic behind it consists in: > > - adding the scheduled functions into a heapified list

Re: palindrome function

2008-07-12 Thread Terry Reedy
Peter Otten wrote: Denis Kasak wrote: Basically, it reverses the list in place, so it modifies the list which called it. It does not return a /new/ list which is a reversed version of the original, as you expected it to. Since it doesn't return anything explicitly, Python makes it return None

how can I use exec with main module globals?

2008-07-12 Thread Akathorn Greyhat
Hello, this is my first message in the group. I'm spanish so my english sometimes is really bad, sorry =( I have a problem and I hope someone has the answer. I'm trying to make an in-game python idle, it works great but the exec statement can't access the main module globals but only the ones th

Re: Why is this blowing the stack, thought it was tail-recursive...

2008-07-12 Thread Scott David Daniels
ssecorp wrote: used> and can memoization speed up this even more? Generators get you to an even clearer Fibonacci expression. def _Fibonacci_gen(): a, b = 1, 0 while True: a += b yield a b += a yield b Here's how to use

Re: heapq question

2008-07-12 Thread Giampaolo Rodola'
On 12 Lug, 20:15, Duncan Booth <[EMAIL PROTECTED]> wrote: > "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > > My question is the following: is it safe to avoid to re-heapify() a > > heap when I remove or move an element which is not the first one? > > Example: > > from heapq import * >

SQLAlchmey - new data types for PostgreSQL

2008-07-12 Thread Kless
It would be very interesting if the python community could to access since SQLAlchemy to more features of the PostgreSQL 8.3 RDBMS powerful, as are any new data types as: enumerated (ENUM) [1], XML [2], Universally Unique Identifiers (UUID) [3], and monetary [4]. For if anybody is interested on a

Beginner Question : Iterators and zip

2008-07-12 Thread moogyd
Hi group, I have a basic question on the zip built in function. I am writing a simple text file comparison script, that compares line by line and character by character. The output is the original file, with an X in place of any characters that are different. I have managed a solution for a fixe

Re: why is "self" used in OO-Python?

2008-07-12 Thread castironpi
On Jul 12, 1:01 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > ssecorp <[EMAIL PROTECTED]> wrote: > > 1. Why do I have to pass self into every method in a class? Since I am > > always doing why cant this be automated or abstracted away? > > Are the instances where I won't pass self? > > I imagine th

Re: Does omniORBpy 3.2 supports DII?

2008-07-12 Thread Ilan
On 10 יולי, 17:42, Wolfgang Keller <[EMAIL PROTECTED]> wrote: > > My apologies if this is not the correct forum for thses quiestions, > > It's not the wrong place to ask, but you're more likely to get answers > from the omniORB mailing lists: > > http://www.omniorb-support.com/mailman/listinfo > >

Re: why is "self" used in OO-Python?

2008-07-12 Thread [EMAIL PROTECTED]
On 12 juil, 18:32, ssecorp <[EMAIL PROTECTED]> wrote: > I first learned about OO from Java. > > I much prefer to program in Python though. > > However I am consufed about 2 things. > > 1. Why do I have to pass self into every method in a class? You mean "declare self as the first argument", I assu

fix for wxPython incompatibility of BitTornado 0.3.18

2008-07-12 Thread Avi Kak
If you are unable to use the wxPython-based GUI interfaces in the BitTornado 0.3.18 library on your Ubuntu 8.04 machine, you may wish to download a directory of the library available through http://cobweb.ecn.purdue.edu/~kak/distbt/ If any problems, send me email at [EMAIL PROTECTED] with "B

Re: heapq question

2008-07-12 Thread Duncan Booth
"Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > My question is the following: is it safe to avoid to re-heapify() a > heap when I remove or move an element which is not the first one? > Example: > from heapq import * heap = [2,4,6,7,1,2,3] heapify(heap) del heap[4] #

Re: Why is this blowing the stack, thought it was tail-recursive...

2008-07-12 Thread Marc Christiansen
ssecorp <[EMAIL PROTECTED]> asked: > Why is this blowing the stack, thought it was tail-recursive... Because python does no tail-call optimization. Ciao Marc -- http://mail.python.org/mailman/listinfo/python-list

Re: why is "self" used in OO-Python?

2008-07-12 Thread Duncan Booth
ssecorp <[EMAIL PROTECTED]> wrote: > 1. Why do I have to pass self into every method in a class? Since I am > always doing why cant this be automated or abstracted away? > Are the instances where I won't pass self? > I imagine there is some tradeoff involved otherwise it would have been > done awa

heapq question

2008-07-12 Thread Giampaolo Rodola'
Hi, this is related to what I'm trying to implement here: http://groups.google.com/group/comp.lang.python/browse_thread/thread/20796724c1daf1e1# My question is the following: is it safe to avoid to re-heapify() a heap when I remove or move an element which is not the first one? Example: >>> from

Re: why is "self" used in OO-Python?

2008-07-12 Thread Carl Banks
On Jul 12, 12:32 pm, ssecorp <[EMAIL PROTECTED]> wrote: > I first learned about OO from Java. > > I much prefer to program in Python though. > > However I am consufed about 2 things. Short answer is, "Java isn't the only way OOP." Longer answers follow. > 1. Why do I have to pass self into ever

Re: strip() using strings instead of chars

2008-07-12 Thread Duncan Booth
Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > Duncan Booth schrieb: >>> if url.startswith('http://'): >>> url = url[7:] >> >> If I came across this code I'd want to know why they weren't using >> urlparse.urlsplit()... > > Right, such code can have a smell since in the case of urls, fil

Re: How to create a timer/scheduler in Python?

2008-07-12 Thread Daniel Fetchinson
> I need what I'd call (in .Net) a timer, ie I need to run a function eg > every 2 seconds - it doesn't need to be millisec accurate but it would > be nice if it wasn't eg every 4 seconds or something. > > Rather surprisingly, Core Python (Chun) doesn't seem to index 'timer' > or 'scheduler', which

Re: Bypassing WebFilter security

2008-07-12 Thread Daniel Fetchinson
>> >> I am working in an organization, which is using a very strict >> >> webcontent filter management suite. Due to this i am unable to >> >> download any exe file, or surf web (even the necessary downloads from >> >> sourceforgenet are blocked). I was wondering, if python could be of >> >> any he

why is "self" used in OO-Python?

2008-07-12 Thread ssecorp
I first learned about OO from Java. I much prefer to program in Python though. However I am consufed about 2 things. 1. Why do I have to pass self into every method in a class? Since I am always doing why cant this be automated or abstracted away? Are the instances where I won't pass self? I ima

Re: Confused

2008-07-12 Thread Michael Torrie
eric.butteriss wrote: > Please tell me why may mail is being returned. The message says I > have been blacklisted...for what reason? I never open mail that I > know is not expected and I never send junk or spam. I am trying to > send important info to my cousin. Now I'm confused. Is the python ma

Why is this blowing the stack, thought it was tail-recursive...

2008-07-12 Thread ssecorp
def fib(n): def fibt(a, b, n): if n <= 1: return b else: return fibt(b, a + b, n - 1) if n == 0: return 0 else: return fibt(0, 1, n); and can memoization speed up this even more? tesintg with memoization doesnt really say anythin

Re: spam <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>

2008-07-12 Thread WDC
On Jul 11, 7:21 pm, Nobody Here <[EMAIL PROTECTED]> wrote: > rickman <[EMAIL PROTECTED]> wrote: > > spam > > No fucking shit, Sherlock, why double the volume by pointing out the obvious? Calm down you all. BTW I reported it, yo should too. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using the Random Module.

2008-07-12 Thread WDC
On Jul 12, 10:06 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 11 Jul 2008 12:27:32 -0700, castironpi wrote: > > You want a random integer.  Is there a range you want it in? > > > Past a certain point, you'll exceed the granularity of the random number > > generator, a

Re: Can anyone suggest a date peocedure...

2008-07-12 Thread RV
On Thu, 10 Jul 2008 20:04:27 -0400, RV <[EMAIL PROTECTED]> wrote: Gary, Larry, Michiel , Thanks very much, your helpful info has enabled me to get past a learning bump. Ron -- http://mail.python.org/mailman/listinfo/python-list

Re: Weird lambda rebinding/reassignment without me doing it

2008-07-12 Thread Steven D'Aprano
On Thu, 10 Jul 2008 14:09:16 -0400, Terry Reedy wrote: >> g = lambda x:validate(x) > > This is doubly diseased. > > First, never write a 'name = lambda...' statement since it is equivalent > to a def statement except that the resulting function object lacks a > proper .funcname attribute. U

Re: strip() using strings instead of chars

2008-07-12 Thread Christoph Zwerschke
Duncan Booth schrieb: if url.startswith('http://'): url = url[7:] If I came across this code I'd want to know why they weren't using urlparse.urlsplit()... Right, such code can have a smell since in the case of urls, file names, config options etc. there are specialized functions avail

Re: Converting from local -> UTC

2008-07-12 Thread Sebastian "lunar" Wiesner
Gabriel Genellina <[EMAIL PROTECTED]>: > En Fri, 11 Jul 2008 15:42:37 -0300, Keith Hughitt > <[EMAIL PROTECTED]> escribi�: > >> I am having a little trouble figuring out how to convert a python >> datetime to UTC. I have a UTC date (e.g. 2008-07-11 00:00:00). I would >> like to create a UTC date

..\..\Python-2.5.2\Include\pyport.h(117) : fatal error C1189: #error : "Python needs a typedef for Py_ssize_t in pyport.h."

2008-07-12 Thread Bill Davy
When I try and compile using VS2003 for Release. Compiles fine for Debug. In a hurry (should be gardening). Any solution? TIA Bill -- http://mail.python.org/mailman/listinfo/python-list

Re: Perfect hashing for Py

2008-07-12 Thread Raymond Hettinger
On Jul 12, 10:13 am, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On Jul 11, 3:01 pm, [EMAIL PROTECTED] wrote: > > > I have found this perfect hash (minimal too) > > implementation:http://burtleburtle.net/bob/hash/perfect.html > > > I have already translated part of it to D, and it seems to work

Re: Using the Random Module.

2008-07-12 Thread Steven D'Aprano
On Fri, 11 Jul 2008 12:27:32 -0700, castironpi wrote: > You want a random integer. Is there a range you want it in? > > Past a certain point, you'll exceed the granularity of the random number > generator, and some values in the range will never be generated. You might want to produce an unboun

Re: Confused

2008-07-12 Thread D'Arcy J.M. Cain
On Sat, 12 Jul 2008 14:06:37 +0200 "eric.butteriss" <[EMAIL PROTECTED]> wrote: > Please tell me why may mail is being returned. The message says I have been > blacklisted...for what reason? I never open mail that I know is not expected > and I never send junk or spam. I am trying to send importan

Re: How to create a timer/scheduler in Python?

2008-07-12 Thread Marc 'BlackJack' Rintsch
On Sat, 12 Jul 2008 10:30:00 +0100, John Dann wrote: > Looking around on the net I can see references to a thread timer, but > I'm not really looking to start any new threads (I just want part of > the GUI to update every 2 secs) and don't want to get into that sort > of complication while still j

Re: Changing self: if self is a tree how to set to a different self

2008-07-12 Thread Kay Schluehr
On 10 Jul., 15:19, Bart Kastermans <[EMAIL PROTECTED]> wrote: > I am playing with some trees. In one of the procedures I wrote > for this I am trying to change self to a different tree. A tree > here has four members (val/type/left/right). I found that self = SS > does not work; I have to write

Re: Changing self: if self is a tree how to set to a different self

2008-07-12 Thread Paul McGuire
On Jul 12, 6:18 am, Bart Kastermans <[EMAIL PROTECTED] macbook.local> wrote: > This uses the function: > > def NoneOr (tree, mem_function, *arguments): >     """ if tree is not None then tree.mem_function (arguments). """ >     if tree == None: >         return None >     else: >         return get

Re: Use of index

2008-07-12 Thread Michiel Overtoom
SUBHABRATA wrote... > Now, my q is can we use index like find? Yes, you can. There is only a difference when the string is not found: the 'find()' function will return -1, whereas 'index()' function will raise a ValueError exception. For example: >>> b="A spaghetti monster is always great" >>>

Re: win32com.client (Howto edit Contacts in Outlook)

2008-07-12 Thread Bill Davy
"Tim Golden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Bill Davy wrote: >> Traceback (most recent call last): >> File "H:/Personal/OutlookIF1/t2.py", line 18, in >> outlook = win32com.client.gencache.EnsureDispatch >> ("Outlook.Application") >> File "C:\Python25\Lib\s

Re: Python 3.0 and removal of the 'string' module

2008-07-12 Thread Colin J. Williams
Benjamin wrote: On Jul 11, 3:06 am, Ben Finney <[EMAIL PROTECTED]> wrote: "Martin v. Löwis" <[EMAIL PROTECTED]> writes: This is rather disappointing. Is that entire page suspect? All documentation about Python 3 is suspect until Python 3 gets actually released (nobody can say for sure how the

Re: sending input to an embedded application

2008-07-12 Thread mefyl
Uwe Schmitt wrote: > On 12 Jul., 09:08, George Oliver <[EMAIL PROTECTED]> wrote: >> What I would like to do is take a program and embed it or put it >> within a Python-run GUI, using the GUI just to capture and send input >> to the application, and display the ouput. > > Which interface does your

Re: Help with using findAll() in BeautifulSoup

2008-07-12 Thread Paul McGuire
On Jul 12, 12:55 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Alexnb wrote: > > I am making an app that screen scapes > > dictionary.com for definitions. > > Do they have a policy for doing that? > >From the Dictionary.com Terms of Use (http://dictionary.reference.com/ help/terms.html): 3.2 You

Confused

2008-07-12 Thread eric.butteriss
Please tell me why may mail is being returned. The message says I have been blacklisted...for what reason? I never open mail that I know is not expected and I never send junk or spam. I am trying to send important info to my cousin. Thank you in anticipation E Butteriss-- http://mail.python.org

Re: Changing self: if self is a tree how to set to a different self

2008-07-12 Thread Bart Kastermans
Terry Reedy <[EMAIL PROTECTED]> writes: > Bart Kastermans wrote: >> I am playing with some trees. In one of the procedures I wrote >> for this I am trying to change self to a different tree. A tree >> here has four members (val/type/left/right). I found that self = SS >> does not work; I have t

Re: sending input to an embedded application

2008-07-12 Thread Uwe Schmitt
On 12 Jul., 09:08, George Oliver <[EMAIL PROTECTED]> wrote: > hi, I'm a novice programmer trying to better define a hobby project > I'm thinking of. > > What I would like to do is take a program and embed it or put it > within a Python-run GUI, using the GUI just to capture and send input > to the

Re: How to create a timer/scheduler in Python?

2008-07-12 Thread Uwe Schmitt
On 12 Jul., 11:30, John Dann <[EMAIL PROTECTED]> wrote: > I need what I'd call (in .Net) a timer, ie I need to run a function eg > every 2 seconds - it doesn't need to be millisec accurate but it would > be nice if it wasn't eg every 4 seconds or something. > > Rather surprisingly, Core Python (Chu

Use of index

2008-07-12 Thread SUBHABRATA
Dear All, I have a small question. If I have code line like the following: a1="God" a2="God is always great" a3=a2.index(a1) a4=a2.find(a1) a5=a2.split() a6=a5.index(a1) a7=a5.find(a1) # Invalid as find is applicable only in string but not in list. if a4>-1: print "God may be always great" --

Re: Help with BeautifulSoup

2008-07-12 Thread Michiel Overtoom
Alex wrote... > >Okay, heres the general idea of the html I have to work with: > > > noun > > > > > verb > > > > > >Okay, I left off some stuff. I wish you didn't, or at least provided an URL where I can get the page which you are trying to parse. Now I don't have a vali

How to create a timer/scheduler in Python?

2008-07-12 Thread John Dann
I need what I'd call (in .Net) a timer, ie I need to run a function eg every 2 seconds - it doesn't need to be millisec accurate but it would be nice if it wasn't eg every 4 seconds or something. Rather surprisingly, Core Python (Chun) doesn't seem to index 'timer' or 'scheduler', which leaves me

Re: decorator to prevent adding attributes to class?

2008-07-12 Thread rbossy
>> class Foo(Freezeable): >> def __init__(self): >> self.bar = 42 >> self.freeze() # ok, we set all variables, no more from here >> >> >> x = Foo() >> print x.bar >> x.bar = -42 >> print x.bar >> x.baz = "OMG! A typo!" >> > >Pretty nice, but unfortunately the subclass has to remember to call freeze

Re: MySQLdb will only import for root

2008-07-12 Thread martinnorth
Peter Otten wrote: martinnorth wrote: Hi, I am running Python and MySQL on Ubuntu and have installed MySQLdb. If I try to import MySQLdb I get the following error: ActivePython 2.5.2.2 (ActiveState Software Inc.) based on Python 2.5.2 (r252:60911, Mar 27 2008, 16:42:08) [GCC 3.3.1 (SuSE Linux

Re: variable question

2008-07-12 Thread Peter Otten
happy wrote: > I think its better to leave the "teach kiddies" tutoring opportunity > for the python experts out there. If you know how to make some simple scripts that do something that kids find interesting and are able to convey your enthusiasm, you are better suited to teach than any expert w

Re: variable question

2008-07-12 Thread happy
On Jul 12, 8:05 am, Robert Lehmann <[EMAIL PROTECTED]> wrote: > On Fri, 11 Jul 2008 20:13:04 -0700, happy wrote: > > Can a variable be considered the simplest of the data structures. I am > > tutoring some kids about basics of programming using python. Not an > > expert in computer sciences, but am

Re: Perfect hashing for Py

2008-07-12 Thread Raymond Hettinger
On Jul 11, 3:01 pm, [EMAIL PROTECTED] wrote: > I have found this perfect hash (minimal too) > implementation:http://burtleburtle.net/bob/hash/perfect.html > > I have already translated part of it to D, and it seems to work well > enough. As discussed in the PyConDue, I think this may be used in >

Re: palindrome function

2008-07-12 Thread Denis Kasak
Peter Otten wrote: Denis Kasak wrote: Basically, it reverses the list in place, so it modifies the list which called it. It does not return a /new/ list which is a reversed version of the original, as you expected it to. Since it doesn't return anything explicitly, Python makes it return None.

sending input to an embedded application

2008-07-12 Thread George Oliver
hi, I'm a novice programmer trying to better define a hobby project I'm thinking of. What I would like to do is take a program and embed it or put it within a Python-run GUI, using the GUI just to capture and send input to the application, and display the ouput. Specifically I want to use a Pytho