Re: with open('com1', 'r') as f:

2009-04-04 Thread Lawrence D'Oliveiro
In message <01e842d6$0$20654$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > Firstly, what you describe is an implementation detail of CPython, not > Python the language. Jython does not close files as soon as they become > inaccessible, and IronPython and CLPython may not. That's a limitat

Re: Python Goes Mercurial

2009-04-04 Thread Lawrence D'Oliveiro
In message <262497db-d2fd-4217-978c- fc5571f10...@c11g2000yqj.googlegroups.com>, Michele Simionato wrote: > If Martin - which is well above the average programmer - > says that he would need help with Git, I take this as > meaning that most people would get lost with Git. I don't feel lost with G

Re: with open('com1', 'r') as f:

2009-04-04 Thread Terry Reedy
Lawrence D'Oliveiro wrote: In message <91e09eaf-5a25-4a6b-b131- a5245970b...@f19g2000yqh.googlegroups.com>, gert wrote: On Apr 4, 12:58 am, Lawrence D'Oliveiro wrote: In message <8bc55c05-19da-41c4- b916-48e0a4be4...@p11g2000yqe.googlegroups.com>, gert wrote: with open('com1', 'r') as f: f

Re: Python Goes Mercurial

2009-04-04 Thread Jeroen Ruigrok van der Werven
-On [20090405 06:05], Michele Simionato (michele.simion...@gmail.com) wrote: >P.S. the thing I do not understand if why we are moving >away from Subversion. Will all the new features entered >in 1.5 and 1.6 Subversion is now not so bad as it used to >be and it has the advantage of being already the

Re: "Pythoner",Wish me luck!

2009-04-04 Thread Jeroen Ruigrok van der Werven
-On [20090403 20:35], barisa (bbaj...@gmail.com) wrote: >my question is : what benefit is using interactive intrepreter ? Install ipython. It's an extension wrapper around the interactive shell and allows a lot of very nice features in additional to the standard shell, such as tab completion. Th

Re: with open('com1', 'r') as f:

2009-04-04 Thread Steven D'Aprano
On Sun, 05 Apr 2009 15:51:31 +1200, Lawrence D'Oliveiro wrote: > All Python objects are reference-counted. Once the file object becomes > inaccessible, it is automatically closed. Simple. If only it were so simple. Firstly, what you describe is an implementation detail of CPython, not Python th

Re: How to free /destroy object created by PyTuple_New

2009-04-04 Thread grbgooglefan
On Apr 4, 10:27 pm, Andrew Svetlov wrote: > To destroy every python object you need to call Py_DECREF. > To call python code fron you C thread you need to use pair > PyGILState_Ensure/PyGILState_Release. In my case, my C application has multiple threads & they are accessing a single Python Interp

Re: Creating a session in windows to auth to remote machines

2009-04-04 Thread Tim Golden
ericwoodwo...@gmail.com wrote: Hi, I'm trying to auth to remote machines so I can plunder WMI to get logs and settings and the like. My script works for most of my machines because they're all in the same domain and I run the script as somebody who has enough access to get at this stuff but

Re: Generators/iterators, Pythonicity, and primes

2009-04-04 Thread Kay Schluehr
> Question: Is there a way to implement this algorithm using generator > expressions only -- no "yield" statements allowed? Yes. Avoiding the yield statement is easy but one might eventually end up with two statements because one has to produce a side effect on the primes list. However we can use

Re: Killing threads

2009-04-04 Thread ericwoodworth
On Apr 5, 12:22 am, a...@pythoncraft.com (Aahz) wrote: > In article <4b52f7d7-81d5-4141-9385-ee8cfb90a...@l1g2000yqk.googlegroups.com>, > >   wrote: > > >I'm using queues to talk between these threads so I could certainly > >put some kind of message on the queue that causes the threads to > >commit

Re: Generators/iterators, Pythonicity, and primes

2009-04-04 Thread Miles
On Sat, Apr 4, 2009 at 2:50 PM, John Posner wrote: > Inspired by recent threads (and recalling my first message to Python > edu-sig), I did some Internet searching on producing prime numbers using > Python generators. Most algorithms I found don't go for the infinite, > contenting themselves with "

Re: Killing threads

2009-04-04 Thread Aahz
In article <4b52f7d7-81d5-4141-9385-ee8cfb90a...@l1g2000yqk.googlegroups.com>, wrote: > >I'm using queues to talk between these threads so I could certainly >put some kind of message on the queue that causes the threads to >commit suicide but I'm thinking there's a more built in way to do what >I

Re: Python Goes Mercurial

2009-04-04 Thread Michele Simionato
On Apr 5, 5:49 am, Lawrence D'Oliveiro wrote: > Everybody needs help sometime. If you're accustomed to centralized version > control (CVS and SVN), it probably takes some time to get used to the way > distributed systems work. It's nothing to be ashamed of. If Martin - which is well above the av

Re: possible pairings in a set

2009-04-04 Thread Steven D'Aprano
On Sat, 04 Apr 2009 17:42:58 -0700, Ross wrote: > I'm new to python and I'm trying to come up with a function that takes a > given number of players in a game and returns all possible unique > pairings. Here's the code I've come up with so far, but I'm not getting > the output I'd like to: Others

Re: with open('com1', 'r') as f:

2009-04-04 Thread Lawrence D'Oliveiro
In message <91e09eaf-5a25-4a6b-b131- a5245970b...@f19g2000yqh.googlegroups.com>, gert wrote: > On Apr 4, 12:58 am, Lawrence D'Oliveiro central.gen.new_zealand> wrote: > >> In message <8bc55c05-19da-41c4- >> b916-48e0a4be4...@p11g2000yqe.googlegroups.com>, gert wrote: >> >>> with open('com1', 'r')

Re: Python Goes Mercurial

2009-04-04 Thread Lawrence D'Oliveiro
In message <49d80a4a$0$30643$9b622...@news.freenet.de>, "Martin v. Löwis" wrote: >In message , Lawrence D'Oliveiro wrote: > >> Post an example of what you were trying to do, with the exact messages, >> and we can walk you through it. > > Unfortunately, these are many months ago, and I don't reca

Killing threads

2009-04-04 Thread ericwoodworth
Hi, I'm new to python and even newer to threading and it seems as though I'm missing something fundamental about threads. Basically I have a program that looks like this: class ThreadOne(threading.Thread): while 1: do stuff class ThreadTwo(threading.Thread): while 1:

Re: possible pairings in a set

2009-04-04 Thread Dave Angel
MRAB wrote: Dave Angel wrote: Ross wrote: I'm new to python and I'm trying to come up with a function that takes a given number of players in a game and returns all possible unique pairings. Here's the code I've come up with so far, but I'm not getting the output I'd like to: def all_pairi

Re: Generators/iterators, Pythonicity, and primes

2009-04-04 Thread Terry Reedy
John Posner wrote: Inspired by recent threads (and recalling my first message to Python edu-sig), I did some Internet searching on producing prime numbers using Python generators. Most algorithms I found don't go for the infinite, contenting themselves with "list all the primes below a given numb

Re: Why doesn't StopIteration get caught in the following code?

2009-04-04 Thread Terry Reedy
grocery_stocker wrote: ... while True: ...i = gen.next() ...print i ... 0 1 4 Traceback (most recent call last): File "", line 2, in ? StopIteration If you had written for item in gen: print(i) then StopIteration from gen would be caught. One expansion of a for loop is (in the abo

Re: Python Goes Mercurial

2009-04-04 Thread skip
Martin> I wasn't really asking for help, merely pointing out that I Martin> dislike git because it makes me ask for help (something I did Martin> not have to do for CVS or subversion, except for very special Martin> cases). In fact, Martin is generally the guy answering the CVS an

Re: pygame and socket.recv

2009-04-04 Thread Aaron Brady
On Apr 2, 4:13 am, Tim Wintle wrote: > On Wed, 2009-04-01 at 18:45 -0700, Aaron Brady wrote: > > > My game loop looks like this: > > > poll events, get 1 at most > > send to server > > wait for server reply > > render entire frame > > The look I'm suggesting is: > > poll events > write to (non-blo

Re: pygame and socket.recv

2009-04-04 Thread Aaron Brady
On Apr 2, 5:46 pm, Tim Wintle wrote: > On Thu, 2009-04-02 at 06:50 -0700, Aaron Brady wrote: > > It's just that if you register a collision in between the time that > > one object has changed its position and momentum, and the time you > > learn about it, you have to retroactively edit the collisi

Re: Python Tk Tix GUI documentation & builder overview and tips

2009-04-04 Thread Aahz
[posted & e-mailed] In article , wrote: > >Before starting I spent some effort to find >a) relevant documentation, >b) GUI Builders which might help me, >c) answers to non-obvious questions. > >The process took some time and effort so I want to share my findings: Adding this to wiki.python.org/

Re: Module caching

2009-04-04 Thread Aaron Scott
>         req.write(str(lab.game.settings.daemons)) >         del lab.game.settings >         req.write(str(lab.game.settings.daemons)) >         lab.game.settings = lab.game.InitGame() >         req.write(str(lab.game.settings.daemons)) > Sorry, that should have been: req.write(str(lab.g

Re: "Pythoner",Wish me luck!

2009-04-04 Thread Linuxwell
Thanks everyone,thank you very much!!! -- http://mail.python.org/mailman/listinfo/python-list

Re: cProfile.py not found.

2009-04-04 Thread skip
Rahul> I need to profile a slow-running code. The problem is I cannot Rahul> seem to find cProfile.py. You want cProfile.c (compiled to cProfile.so). Rahul> I am using Python 2.4.4 (#3, Feb 17 2008, 15:06:10). cProfile was new in 2.5, but the code backports with no problem to 2.4.

Re: python docs redirect on python.org is old

2009-04-04 Thread Martin v. Löwis
Brandon Craig Rhodes wrote: > When I visit ... > >http://www.python.org/doc/lib/lib.html > > ... I get redirected to ... > >http://www.python.org/doc/2.5.2/lib/lib.html > > ... which seems a bit old. That is intentional. Use http://docs.python.org/library/ instead. Regards, Martin -

Re: possible pairings in a set

2009-04-04 Thread MRAB
Dave Angel wrote: Ross wrote: I'm new to python and I'm trying to come up with a function that takes a given number of players in a game and returns all possible unique pairings. Here's the code I've come up with so far, but I'm not getting the output I'd like to: def all_pairings(players):

Re: Python Goes Mercurial

2009-04-04 Thread Martin v. Löwis
>> I don't like git because it is too difficult for me. In many cases, >> git would refuse to do operations like updating or local committing, >> producing error messages I was not able to understand ... > > Post an example of what you were trying to do, with the exact messages, and > we can walk

python docs redirect on python.org is old

2009-04-04 Thread Brandon Craig Rhodes
When I visit ... http://www.python.org/doc/lib/lib.html ... I get redirected to ... http://www.python.org/doc/2.5.2/lib/lib.html ... which seems a bit old. -- Brandon Craig Rhodes bran...@rhodesmill.org http://rhodesmill.org/brandon -- http://mail.python.org/mailman/listinfo/python

Re: possible pairings in a set

2009-04-04 Thread Dave Angel
Ross wrote: I'm new to python and I'm trying to come up with a function that takes a given number of players in a game and returns all possible unique pairings. Here's the code I've come up with so far, but I'm not getting the output I'd like to: def all_pairings(players): cleanlist =

Re: Python Goes Mercurial

2009-04-04 Thread Martin v. Löwis
>> I don't like git because it is too difficult for me. In many cases, >> git would refuse to do operations like updating or local committing, >> producing error messages I was not able to understand ... > > Post an example of what you were trying to do, with the exact messages, and > we can walk

RE: possible pairings in a set

2009-04-04 Thread John Posner
>> Also, if my code is considered ugly or redundant by this community, >> can you make suggestions to clean it up? Python is pretty mature: if you have a simple, generic problem, the chances are that someone else has already solved it, packaging the solution in a library (or "module"). For your

Re: what does "execfile" mean within profiler output and why does it not have a attached line number

2009-04-04 Thread Robert Kern
On 2009-04-04 18:56, Rahul wrote: "profile" tells me that most of my runtime was spent in just one part (1.28 sec cumulatively out of 1.29 secs. But what is "execfile"? I don't see this as a function call with my python code. Also what's the 0 in the snippet: ":0(execfile)"? Isn't there supposed

Re: possible pairings in a set

2009-04-04 Thread Benjamin Peterson
Ross gmail.com> writes: > Can you guys help me out? Do you have Python 2.6? If so, it's a solved problem. :) import itertools possible_pairings = list(itertools.combinations(players, 2)) -- http://mail.python.org/mailman/listinfo/python-list

Re: what does "execfile" mean within profiler output and why does it not have a attached line number

2009-04-04 Thread John Machin
On Apr 5, 9:56 am, Rahul wrote: > "profile" tells me that most of my runtime was spent in just one part (1.28 > sec cumulatively out of 1.29 secs. But what is "execfile"? I don't see this > as a function call with my python code. Also what's the 0 in the snippet:   > ":0(execfile)"? Isn't there su

possible pairings in a set

2009-04-04 Thread Ross
I'm new to python and I'm trying to come up with a function that takes a given number of players in a game and returns all possible unique pairings. Here's the code I've come up with so far, but I'm not getting the output I'd like to: def all_pairings(players): cleanlist = [] for i

Re: cProfile.py not found.

2009-04-04 Thread Rahul
John Machin wrote in news:0a8400dc-b14b-4bb9-a608- 7327fe88a...@j18g2000prm.googlegroups.com: > Read the fantastic manual: > > http://docs.python.org/library/profile.html [snip] > cProfile is recommended for most users; it's a C extension with > reasonable overhead that makes it suitable

what does "execfile" mean within profiler output and why does it not have a attached line number

2009-04-04 Thread Rahul
"profile" tells me that most of my runtime was spent in just one part (1.28 sec cumulatively out of 1.29 secs. But what is "execfile"? I don't see this as a function call with my python code. Also what's the 0 in the snippet: ":0(execfile)"? Isn't there supposed to be a line-number? Looking u

Re: cProfile.py not found.

2009-04-04 Thread Rahul
John Machin wrote in news:4c8ee09e-71e2-464a-a3c0- b630b4707...@c18g2000prh.googlegroups.com: > Looks like our definitions of "read" differ :-) > Sorry. I ought to have said "skimmed" :) I guess I am one of those guilty lazy-bums that the manual refers to under <<>> -- Rahul -- http://mail

Re: cProfile.py not found.

2009-04-04 Thread John Machin
On Apr 5, 9:41 am, Rahul wrote: > John Machin wrote in news:0a8400dc-b14b-4bb9-a608- > 7327fe88a...@j18g2000prm.googlegroups.com: > > > > > Read the fantastic manual: > > >http://docs.python.org/library/profile.html >  [snip] > >       cProfile is recommended for most users; it's a C extension wi

Re: cProfile.py not found.

2009-04-04 Thread Rahul
John Yeung wrote in news:c0752f32-b0cf-4fde- 87a8-eb665252e...@k41g2000yqh.googlegroups.com: > I believe cProfile was added in 2.5. Your best bet on 2.4 is probably > the profile module. That is what the docs recommend. > Thanks John. That works. I'll use "profile" instead. -- Rahul -- http

Re: cProfile.py not found.

2009-04-04 Thread John Machin
On Apr 5, 8:46 am, Rahul wrote: > I need to profile a slow-running code. The problem is I cannot seem to find   > cProfile.py. > > Where can I get it? Is it not included in the normal distro? I tried > googling it up and theres tons of info on how to use it but no links for > where to download it

Re: cProfile.py not found.

2009-04-04 Thread Robert Kern
On 2009-04-04 18:08, John Yeung wrote: I believe cProfile was added in 2.5. Your best bet on 2.4 is probably the profile module. That is what the docs recommend. Oops, I missed that piece of information. Alternately, the OP can install lsprof, which was cProfile's third-party incarnation bef

[RELEASED] Python 3.1 alpha 2

2009-04-04 Thread Benjamin Peterson
On behalf of the Python development team, I'm thrilled to announce the second alpha release of Python 3.1. Python 3.1 focuses on the stabilization and optimization of features and changes Python 3.0 introduced. For example, the new I/O system has been rewritten in C for speed. Other features inc

Re: cProfile.py not found.

2009-04-04 Thread Rahul
Robert Kern wrote in news:mailman.3312.1238885852.11746.python-l...@python.org: > What system are you on? Some Linux distributions put it into a > separate package, like python-profile. The python.org Windows and Mac > binaries should have it, though. > > THanks Robert. I'm on RHEL. Tried

Re: cProfile.py not found.

2009-04-04 Thread John Yeung
I believe cProfile was added in 2.5. Your best bet on 2.4 is probably the profile module. That is what the docs recommend. John -- http://mail.python.org/mailman/listinfo/python-list

Re: cProfile.py not found.

2009-04-04 Thread Robert Kern
On 2009-04-04 17:46, Rahul wrote: I need to profile a slow-running code. The problem is I cannot seem to find cProfile.py. Where can I get it? Is it not included in the normal distro? I tried googling it up and theres tons of info on how to use it but no links for where to download it from. I a

Re: Creating a session in windows to auth to remote machines

2009-04-04 Thread ericwoodworth
On Apr 4, 6:39 pm, ericwoodwo...@gmail.com wrote: > Hi, >      I'm trying to auth to remote machines so I can plunder WMI to get > logs and settings and the like.  My script works for most of my > machines because they're all in the same domain and I run the script > as somebody who has enough acce

cProfile.py not found.

2009-04-04 Thread Rahul
I need to profile a slow-running code. The problem is I cannot seem to find cProfile.py. Where can I get it? Is it not included in the normal distro? I tried googling it up and theres tons of info on how to use it but no links for where to download it from. I am using Python 2.4.4 (#3, Feb 1

Creating a session in windows to auth to remote machines

2009-04-04 Thread ericwoodworth
Hi, I'm trying to auth to remote machines so I can plunder WMI to get logs and settings and the like. My script works for most of my machines because they're all in the same domain and I run the script as somebody who has enough access to get at this stuff but for machines off the domain I'm

Re: with open('com1', 'r') as f:

2009-04-04 Thread Gabriel Genellina
En Sat, 04 Apr 2009 14:11:12 -0300, gert escribió: On Apr 4, 5:20 pm, Kushal Kumaran wrote: On Fri, 03 Apr 2009 22:10:36 +0200 Christian Heimes wrote: > gert wrote: > > I do understand, and I went looking into pySerial, but it is a long > > way from getting compatible with python3.x and i

Re: is there a way to collect twitts with python?

2009-04-04 Thread '2+
nice info, thanx that # stalk my stalkers example look smart i won't use that one if it was for this ml ;D On Sun, Apr 5, 2009 at 1:22 AM, Bradley Wright wrote: > Just to pimp my own wares: > > http://github.com/bradleywright/yatcip/tree/master > > A Python Twitter client. > -- > http://mail.pyth

Re: with open('com1', 'r') as f:

2009-04-04 Thread Christian Heimes
gert wrote: > On Apr 3, 10:10 pm, Christian Heimes wrote: >> gert wrote: >>> I do understand, and I went looking into pySerial, but it is a long >>> way from getting compatible with python3.x and involves other libs >>> that are big and non pyhton3.x compatible. >> So don't use Python 3.0. Most pe

Re: python needs leaning stuff from other language

2009-04-04 Thread Robert Kern
On 2009-04-04 12:07, Tim Wintle wrote: On Sat, 2009-04-04 at 02:03 -0500, Robert Kern wrote: Let's be clear: python-ideas seems positive on the idea of adding a .clear() method. *Completely removing* slice assignment has not been broached there. Yup, sorry - I did mean to refer to the initial

Re: with open('com1', 'r') as f:

2009-04-04 Thread Diez B. Roggisch
gert schrieb: On Apr 3, 10:10 pm, Christian Heimes wrote: gert wrote: I do understand, and I went looking into pySerial, but it is a long way from getting compatible with python3.x and involves other libs that are big and non pyhton3.x compatible. So don't use Python 3.0. Most people are stil

Re: Testing dynamic languages

2009-04-04 Thread bearophileHUGS
grkunt...: > If I am writing in Python, since it is dynamically, but strongly > typed, I really should check that each parameter is of the expected > type, or at least can respond to the method I plan on calling ("duck" > typing). Every call should be wrapped in a try/except statement to > prevent

RE: Generators/iterators, Pythonicity, and primes

2009-04-04 Thread John Posner
Mark Tolonen said: >> p <= sqrt(n) works a little better :^) >> >> -Mark >> Right you are -- I found that bug in my last-minute check, and then I forgot to trannscribe the fix into the email message. Duh -- thanks! -John E-mail message checked by Spyware Doctor (6.0.0.386) Database

Re: Best Compatible JS Lib for Django

2009-04-04 Thread Daniel Fetchinson
> Does anyone have experience with using JS Libraries with Django? > Do some work better than others and are easier to code with? You might want to ask this on the django list. Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/lis

Re: python needs leaning stuff from other language

2009-04-04 Thread Diez B. Roggisch
Tim Wintle schrieb: On Sat, 2009-04-04 at 02:03 -0500, Robert Kern wrote: Let's be clear: python-ideas seems positive on the idea of adding a .clear() method. *Completely removing* slice assignment has not been broached there. Yup, sorry - I did mean to refer to the initial suggestion, rather

Re: Generators/iterators, Pythonicity, and primes

2009-04-04 Thread Mark Tolonen
"John Posner" wrote in message news:af9fbcc3a7624599a6f51bad2397e...@amdup... Inspired by recent threads (and recalling my first message to Python edu-sig), I did some Internet searching on producing prime numbers using Python generators. Most algorithms I found don't go for the infinite, cont

Re: Cannot find text in *.py files with Windows Explorer?

2009-04-04 Thread John Doe
Dave Angel wrote: > John Doe wrote: >> ...at least by the time I move from Windows XP to Windows 7, >> very likely I will be using a different file manager. If I cannot >> search Python files, now might be a good time to switch. > and the product xplorer2 is athttp://zabkat.com/ > Std versio

Can't one collect twitts and twits in any language?

2009-04-04 Thread Casey Hawthorne
:) -- Regards, Casey -- http://mail.python.org/mailman/listinfo/python-list

Re: lxml and xslt extensions

2009-04-04 Thread Stefan Behnel
Hi, dasacc22 wrote: > On Apr 4, 11:31 am, dasacc22 wrote: >> Im not sure where else to ask this. The best place to ask is the lxml mailing list: http://codespeak.net/mailman/listinfo/lxml-dev >> But basically Im having trouble >> figuring out how to successfully apply multiple extensions in a

Generators/iterators, Pythonicity, and primes

2009-04-04 Thread John Posner
Inspired by recent threads (and recalling my first message to Python edu-sig), I did some Internet searching on producing prime numbers using Python generators. Most algorithms I found don't go for the infinite, contenting themselves with "list all the primes below a given number". Here's a very P

Re: dict view to list

2009-04-04 Thread Aahz
In article <6b4065b0-6af7-4aff-8023-40e5d521f...@v19g2000yqn.googlegroups.com>, Luis Gonzalez wrote: > >Yes, I know the python approach is to use built-ins. >But wouldn't it be cool if we could do mydict.values().tolist() >instead? >It would be more regular and intuitive and readable from an OO p

Best Compatible JS Lib for Django

2009-04-04 Thread ntwrkd
Does anyone have experience with using JS Libraries with Django? Do some work better than others and are easier to code with? TIV -- http://mail.python.org/mailman/listinfo/python-list

Re: with open('com1', 'r') as f:

2009-04-04 Thread Gabriel Genellina
En Sat, 04 Apr 2009 11:29:22 -0300, gert escribió: On Apr 4, 12:58 am, Lawrence D'Oliveiro wrote: In message <8bc55c05-19da-41c4- b916-48e0a4be4...@p11g2000yqe.googlegroups.com>, gert wrote: >     with open('com1', 'r') as f: >         for line in f: >              print('line') Why bother,

Re: Hash of None varies per-machine

2009-04-04 Thread Peter Pearson
On 03 Apr 2009 10:57:05 -0700, Paul Rubin wrote: > ben.tay...@email.com writes: >> 1. Is it correct that if you hash two things that are not equal they >> might give you the same hash value? > > Yes, hashes are 32 bit numbers and there are far more than 2**32 > possible Python values (think of lon

Re: django model problem

2009-04-04 Thread Mark
> > Anyway, since I don't have time to actually install and configure Django > to experiment, I'd suggest you post a query on the django-users mailing > list, at http://groups.google.com/group/django-users Yes, that's what I did - it seems my problem is either a tough one, or it's just impossi

Re: Testing dynamic languages

2009-04-04 Thread grkuntzmd
This may be obvious but, clearly there are (at least) two general types of errors: those caused by data external to the program and those caused by bugs in the program. For all inputs coming into the program from outside, such as user inputs and data coming over a network, the inputs must be comple

Re: with open('com1', 'r') as f:

2009-04-04 Thread gert
On Apr 4, 5:20 pm, Kushal Kumaran wrote: > On Fri, 03 Apr 2009 22:10:36 +0200 > > Christian Heimes wrote: > > gert wrote: > > > I do understand, and I went looking into pySerial, but it is a long > > > way from getting compatible with python3.x and involves other libs > > > that are big and non p

Re: python needs leaning stuff from other language

2009-04-04 Thread Tim Wintle
On Sat, 2009-04-04 at 02:03 -0500, Robert Kern wrote: > > Let's be clear: python-ideas seems positive on the idea of adding a .clear() > method. *Completely removing* slice assignment has not been broached there. Yup, sorry - I did mean to refer to the initial suggestion, rather than my comments

Re: Testing dynamic languages

2009-04-04 Thread Tim Wintle
On Sat, 2009-04-04 at 06:37 -0700, grkunt...@gmail.com wrote: > If I am writing in Python, since it is dynamically, but strongly > typed, I really should check that each parameter is of the expected > type, or at least can respond to the method I plan on calling ("duck" > typing). Every call should

Re: Testing dynamic languages

2009-04-04 Thread Francesco Bochicchio
On Sat, 04 Apr 2009 07:37:44 -0700, grkuntzmd wrote: > I am a Java developer. There, I said it :-). > > When I am writing code, I can rely on the compiler to confirm that > any methods I write will be called with parameters of the "right" > type. I do not need to test that parameter #1 really is

Re: is there a way to collect twitts with python?

2009-04-04 Thread Bradley Wright
Just to pimp my own wares: http://github.com/bradleywright/yatcip/tree/master A Python Twitter client. -- http://mail.python.org/mailman/listinfo/python-list

Re: Hash of None varies per-machine

2009-04-04 Thread Hendrik van Rooyen
"Steven D'Aprano" wrote: >Seems to me you have misunderstood the way pickling works. Yeah right - have you ever looked at the pickle code? Good to hear it "just works" :-) - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: lxml and xslt extensions

2009-04-04 Thread dasacc22
On Apr 4, 11:31 am, dasacc22 wrote: > Hi, > > Im not sure where else to ask this. But basically Im having trouble > figuring out how to successfully apply multiple extensions in a single > transformation. So for example if i have > > > > > > > > in my xsl and my xslt extension looks like > >

Re: Cannot find text in *.py files with Windows Explorer?

2009-04-04 Thread Dave Angel
John Doe wrote: Tim Golden wrote: Now I think about it, try searching for "xplorer2" since I think I mentioned that I have used that instead of explorer for some while. Yeah... at least by the time I move from Windows XP to Windows 7, very likely I will be using a different file manag

Re: Why doesn't StopIteration get caught in the following code?

2009-04-04 Thread andrew cooke
grocery_stocker wrote: while True: > ...i = gen.next() > ...print i > ... > 0 > 1 > 4 python's magic isn't as magic as you hope. roughly speaking, it only does the necessary rewriting (writing the equivalent code with next etc etc) when you define a function or a method that contains

Re: Why doesn't StopIteration get caught in the following code?

2009-04-04 Thread Dave Angel
grocery_stocker wrote: Given the following [cdal...@localhost ~]$ python Python 2.4.3 (#1, Oct 1 2006, 18:00:19) [GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2 Type "help", "copyright", "credits" or "license" for more information. def counter(): ... mylist = range(3) ... fo

lxml and xslt extensions

2009-04-04 Thread dasacc22
Hi, Im not sure where else to ask this. But basically Im having trouble figuring out how to successfully apply multiple extensions in a single transformation. So for example if i have in my xsl and my xslt extension looks like class TagExtension(etree.XSLTExtension): def execute( ..., ou

Why doesn't StopIteration get caught in the following code?

2009-04-04 Thread grocery_stocker
Given the following [cdal...@localhost ~]$ python Python 2.4.3 (#1, Oct 1 2006, 18:00:19) [GCC 4.1.1 20060928 (Red Hat 4.1.1-28)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def counter(): ... mylist = range(3) ... for i in mylist: ... yield i*i .

Re: with open('com1', 'r') as f:

2009-04-04 Thread Kushal Kumaran
On Fri, 03 Apr 2009 22:10:36 +0200 Christian Heimes wrote: > gert wrote: > > I do understand, and I went looking into pySerial, but it is a long > > way from getting compatible with python3.x and involves other libs > > that are big and non pyhton3.x compatible. > > So don't use Python 3.0. Most

Re: statvfs clearance

2009-04-04 Thread Dave Angel
Hrvoje Niksic wrote: Sreejith K writes: Python's statvfs module contains the following indexes to use with os.statvfs() that contains the specified information statvfs.F_BSIZE Preferred file system block size. [...] statvfs.F_NAMEMAX Maximum file name length. Can anyon

Re: python needs leaning stuff from other language

2009-04-04 Thread Zamnedix
On Apr 3, 8:48 am, Steven D'Aprano wrote: > On Fri, 03 Apr 2009 08:23:22 -0700, Zamnedix wrote: > > On Apr 2, 3:25 pm, online.serv...@ymail.com wrote: > >> python's list needs a thing  list.clear()  like c# arraylist and > >> python needs a writeline() method > > > Please don't post things like li

Re: statvfs clearance

2009-04-04 Thread Albert Hopkins
On Sat, 2009-04-04 at 15:48 +0200, Hrvoje Niksic wrote: > Sreejith K writes: > > > Python's statvfs module contains the following indexes to use with > > os.statvfs() that contains the specified information > > > > statvfs.F_BSIZE > > Preferred file system block size. > [...] > > statvfs.F_NA

Re: with open('com1', 'r') as f:

2009-04-04 Thread gert
On Apr 3, 10:10 pm, Christian Heimes wrote: > gert wrote: > > I do understand, and I went looking into pySerial, but it is a long > > way from getting compatible with python3.x and involves other libs > > that are big and non pyhton3.x compatible. > > So don't use Python 3.0. Most people are still

Re: python needs leaning stuff from other language

2009-04-04 Thread Paul McGuire
On Apr 3, 11:48 pm, Tim Wintle wrote: > del mylist[:] > * or * > mylist[:] = [] > * or * > mylist = [] > > which, although semantically similar are different as far as the > interpreter are concerned (since two of them create a new list): > Only the last item creates a new list of any consequence

Re: Cannot find text in *.py files with Windows Explorer?

2009-04-04 Thread drobi...@gmail.com
On Apr 4, 12:21 am, John Doe wrote: > Anybody have a solution for Windows (XP) Explorer search not finding > ordinary text in *.py files? > > Thanks. Googling turns up this. http://www.pcmag.com/article2/0,4149,1206399,00.asp I haven't tried it myself. -- http://mail.python.org/mailman/listinfo/

Re: Testing dynamic languages

2009-04-04 Thread Luis Gonzalez
On Apr 4, 11:17 am, Emmanuel Surleau wrote: > On Saturday 04 April 2009 15:37:44 grkunt...@gmail.com wrote: > > > I am a Java developer. There, I said it :-). Don't worry. I also do terrible things to support my family... -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing dynamic languages

2009-04-04 Thread andrew cooke
andrew cooke wrote: > if you are going to do that, stay with java. seriously - i too, am a java > developer about half the time, and you can make java pretty dynamic if you > try hard enough. look at exploiting aspects and functional programming > libraries, for example. also, of course, scala.

Re: with open('com1', 'r') as f:

2009-04-04 Thread gert
On Apr 4, 12:58 am, Lawrence D'Oliveiro wrote: > In message <8bc55c05-19da-41c4- > > b916-48e0a4be4...@p11g2000yqe.googlegroups.com>, gert wrote: > >     with open('com1', 'r') as f: > >         for line in f: > >              print('line') > > Why bother, why not just > >     for line in open('co

Re: How to free /destroy object created by PyTuple_New

2009-04-04 Thread Andrew Svetlov
To destroy every python object you need to call Py_DECREF. To call python code fron you C thread you need to use pair PyGILState_Ensure/PyGILState_Release. -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to extract from regex in if statement

2009-04-04 Thread Paul McGuire
On Apr 3, 9:26 pm, Paul Rubin wrote: > bwgoudey writes: > > elif re.match("^DATASET:\s*(.+) ", line): > >         m=re.match("^DATASET:\s*(.+) ", line) > >         print m.group(1)) > > Sometimes I like to make a special class that saves the result: > >   class Reg(o

Re: Testing dynamic languages

2009-04-04 Thread Emmanuel Surleau
On Saturday 04 April 2009 15:37:44 grkunt...@gmail.com wrote: > I am a Java developer. There, I said it :-). > > When I am writing code, I can rely on the compiler to confirm that > any methods I write will be called with parameters of the "right" > type. I do not need to test that parameter #1 re

Re: Cannot find text in *.py files with Windows Explorer?

2009-04-04 Thread John Machin
On Apr 4, 3:21 pm, John Doe wrote: > Anybody have a solution for Windows (XP) Explorer search not finding > ordinary text in *.py files? > Get a grep on yourself! http://gnuwin32.sourceforge.net/packages/grep.htm -- http://mail.python.org/mailman/listinfo/python-list

Re: Testing dynamic languages

2009-04-04 Thread andrew cooke
grkunt...@gmail.com wrote: > If I am writing in Python, since it is dynamically, but strongly > typed, I really should check that each parameter is of the expected > type, or at least can respond to the method I plan on calling ("duck" > typing). Every call should be wrapped in a try/except stateme

Re: statvfs clearance

2009-04-04 Thread Hrvoje Niksic
Sreejith K writes: > Python's statvfs module contains the following indexes to use with > os.statvfs() that contains the specified information > > statvfs.F_BSIZE > Preferred file system block size. [...] > statvfs.F_NAMEMAX > Maximum file name length. > > Can anyone tell me (or give me s

  1   2   >