Beautiful soup : why does "string" not give me the string?

2009-04-01 Thread Gabriel Rossetti
Hello everyone, I am using beautiful soup to parse some HTML and I came across something strange. Here is an illustration: >>> soup = BeautifulSoup(u'hello ça boume>> soup hello ça boume >>> soup.find("div", "text") hello ça boume >>> soup.find("div", "text").string >>> soup.find("div", "text"

Re: urllib2 problem, data param not working? : DISREGARD

2009-04-01 Thread Gabriel Rossetti
Gabriel Rossetti wrote: Hello everyone, I am having a problem with urllib2, when I do this : post = urllib.urlencode(post) request = urllib2.Request(url, post) response = urllib2.urlopen(request) or this : post = urllib.urlencode(post) response = urllib2.urlopen(url, post) or

Re: Python Goes Mercurial

2009-04-01 Thread Chris Rebert
On Wed, Apr 1, 2009 at 12:01 AM, Carl Banks wrote: > On Mar 31, 6:25 pm, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >> >> >> So what were these "strong antipathies" towards Git, exactly? > > Apparently Mercurial h

Re: Thoughts on language-level configuration support?

2009-04-01 Thread Kay Schluehr
> "Discoverable", as in built-in tools that let you have the following > conversation: "Program, tell me all the things I can configure about > you" - "Okay, here they all are". No digging through the source > required. But this doesn't have any particular meaning. If I run a dir(obj) command al

Re: Python Goes Mercurial

2009-04-01 Thread Carl Banks
On Mar 31, 6:25 pm, Lawrence D'Oliveiro wrote: > > > So what were these "strong antipathies" towards Git, exactly? Apparently Mercurial had it's own hate club, and the reaction on python-dev was so severe GvR backtracked o

Re: python for loop

2009-04-01 Thread Carl Banks
On Mar 31, 7:23 pm, Lada Kugis wrote: > On 01 Apr 2009 01:26:41 GMT, Steven D'Aprano > > wrote: > > >Why Python (and other languages) count from zero instead of one, and > >why half-open intervals are better than closed intervals: > > >http://www.johndcook.com/blog/2008/06/26/why-computer-scienti

Re: Does Python have certificate?

2009-04-01 Thread Lawrence D'Oliveiro
-- http://mail.python.org/mailman/listinfo/python-list

A design problem I met again and again.

2009-04-01 Thread 一首诗
Hi all, I am a programmer who works with some different kinds of programming languages, like python, C++(in COM), action script, C#, etc. Today, I realized that, what ever language I use, I always meet a same problem and I think I never solve it very well. The problem is : how to break my app in

Re: python for loop

2009-04-01 Thread Diez B. Roggisch
Lada Kugis schrieb: On 01 Apr 2009 01:26:41 GMT, Steven D'Aprano wrote: Why Python (and other languages) count from zero instead of one, and why half-open intervals are better than closed intervals: http://www.johndcook.com/blog/2008/06/26/why-computer-scientists-count-from-zero/ http://www.

Re: python for loop

2009-04-01 Thread Steven D'Aprano
On Wed, 01 Apr 2009 04:39:26 +0100, Rhodri James wrote: > Dragging this back to the original topic, you clearly find starting list > indices from zero unintuitive. To me, with a mathematical background, > it's not just intuitive, it's correct. All sorts of useful properties > fall out from that,

Re: Beazley on Generators

2009-04-01 Thread Michele Simionato
On Apr 1, 7:57 am, Lawrence D'Oliveiro wrote: > In message > , Michele > > Simionato wrote: > > Excellent reading for everybody wanting to understand cooperative > > concurrency! > > Hey, some of us were doing "cooperative concurrency" programming old MacOS > for years. It was generally considered

Re: Beautiful soup : why does "string" not give me the string?

2009-04-01 Thread Jeremiah Dodds
On Wed, Apr 1, 2009 at 8:25 AM, Gabriel Rossetti < gabriel.rosse...@arimaz.com> wrote: > Hello everyone, > > I am using beautiful soup to parse some HTML and I came across something > strange. > Here is an illustration: > > >>> soup = BeautifulSoup(u'hello ça boume >>> soup > hello ça boume > >>>

Re: udp package header

2009-04-01 Thread Jeremiah Dodds
On Tue, Mar 31, 2009 at 6:19 PM, Artur M. Piwko wrote: > In the darkest hour on Tue, 24 Mar 2009 00:50:10 + (UTC), > R. David Murray screamed: > >> I got a problem. İ want to send udp package and get this package (server > and > >> clinet ). it's easy to python but i want to look the udp hea

Re: A design problem I met again and again.

2009-04-01 Thread Lawrence D'Oliveiro
In message <48506803-a6b9-432b-acef- b75f76e90...@v23g2000pro.googlegroups.com>, 一首诗 wrote: > Until one day I find service has nearly 100 methods and 6000 lines of > code. I don't need to read any programming book to know that it's > too big. The question is not how many lines or how many metho

List of paths

2009-04-01 Thread Nico Grubert
Dear Python developers I have the following (sorted) list. ['/notebook', '/notebook/mac', '/notebook/mac/macbook', '/notebook/mac/macbookpro', '/notebook/pc', '/notebook/pc/lenovo', '/notebook/pc/hp', '/notebook/pc/sony', '/desktop', '/desktop/pc/dell', '/desktop/mac/imac', '/server/hp

Re: I find explicit self much easier to understand if i replace it in my mind with the word "instance"

2009-04-01 Thread Lawrence D'Oliveiro
In message , Steven D'Aprano wrote: > On Tue, 31 Mar 2009 07:05:13 -0700, frolib wrote: > >> I find explicit self much easier to understand if i replace it in my >> mind with the word "instance". I know that using the word "self" though >> is a strong convention. > > Call it "self", "instance",

Re: List of paths

2009-04-01 Thread andrew cooke
>>> def filter(values): ... last = None ... for value in values: ... if last is None or not value.startswith(last): ... yield value ... last = value ... >>> for x in filter(['/notebook', ]): ... print(x) ... /notebook /desktop /server/hp/proliant andrew Nico Grubert wr

Re: A design problem I met again and again.

2009-04-01 Thread andrew cooke
Ò»Ê×Ê« wrote: > 3. completely move codes in service to business classes. Initialize > these classes and pass them to protocol classes. > These protocol classes calls these instances of business classes > instead of call service. These means whenever I add a new business > class. I have to add a

Re: python for loop

2009-04-01 Thread andrew cooke
something i don't think has been mentioned much - if you're using "range()" in your python code then you're almost always doing it wrong. i just grepped lepl and i use range 20 times in 9600 lines of code. out of those, all but 3 are in "quick and dirty" tests or experimental code, not in the ma

Re: python for loop

2009-04-01 Thread andrew cooke
andrew cooke wrote: [...] > so in a small/moderate size library of 600 lines (including blanks and 6000 > comments, but excluding tests and exploratory code) the only time i have > used range with array indices i was either unhappy with the code, or > implem

Re: python for loop

2009-04-01 Thread Dave Angel
Natural language is full of ambiguity, which is why my parents used to argue about the meaning of "next Wednesday," or of "the next exit." Until you have a starting reference, and until you decide whether it's a closed or open interval, you can't be sure everyone will get the same semantics.

BeautifulSoup : why does "string" not give me the string?

2009-04-01 Thread Gabriel Rossetti
Hello everyone, I am using BeautifulSoup to parse some HTML and I came across something strange. Here is an illustration: soup = BeautifulSoup(u'hello ça boume hello ça boume soup.find("div", "text") hello ça boume soup.find("div", "text").string soup.find("div", "text").next u'hello \xe7a

Re: BeautifulSoup : why does "string" not give me the string?

2009-04-01 Thread Gabriel Rossetti
Gabriel Rossetti wrote: Hello everyone, I am using BeautifulSoup to parse some HTML and I came across something strange. Here is an illustration: soup = BeautifulSoup(u'hello ça boume hello ça boume soup.find("div", "text") hello ça boume soup.find("div", "text").string soup.find("div", "te

Re: Thoughts on language-level configuration support?

2009-04-01 Thread jfager
On Apr 1, 3:29 am, Kay Schluehr wrote: > > "Discoverable", as in built-in tools that let you have the following > > conversation:  "Program, tell me all the things I can configure about > > you" - "Okay, here they all are".  No digging through the source > > required. > > But this doesn't have any

Re: python for loop

2009-04-01 Thread bearophileHUGS
Lada Kugis: > (you have 1 apple, you start counting from 1 ...< To little children I now show how to count starting from zero: apple number zero, apple number one, etc, and they find it natural enough :-) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Beautiful soup : why does "string" not give me the string?

2009-04-01 Thread Gabriel Rossetti
Jeremiah Dodds wrote: On Wed, Apr 1, 2009 at 8:25 AM, Gabriel Rossetti mailto:gabriel.rosse...@arimaz.com>> wrote: Hello everyone, I am using beautiful soup to parse some HTML and I came across something strange. Here is an illustration: >>> soup = BeautifulSoup(u'hello

Re: python for loop

2009-04-01 Thread Steven D'Aprano
On Wed, 01 Apr 2009 04:39:39 -0700, bearophileHUGS wrote: > Lada Kugis: >> (you have 1 apple, you start counting from 1 ...< > > To little children I now show how to count starting from zero: apple > number zero, apple number one, etc, and they find it natural enough :-) Ah, but that's not the

Re: Python Goes Mercurial

2009-04-01 Thread Paul Boddie
On 1 Apr, 08:18, Paul Rubin wrote: > Terry Reedy writes: > > > So what were these "strong antipathies" towards Git, exactly? > > > The relevant PEP ishttp://www.python.org/dev/peps/pep-0374/ > > Interesting.  I'm on a project that switched from Mercurial to Git > rec

Re: List of paths

2009-04-01 Thread dorzey
You could use the followingm, where the_list is your list. (I'm new to python so there might be a better way): toremove = [] for x in the_list: for y in the_list: if y.startswith(x) and y != x: toremove.append(y) difference = filter(lambda x:x not

Re: python for loop

2009-04-01 Thread Tim Rowe
2009/4/1 Carl Banks : > I am also an engineer, and I can tell your idea of intuitive is not > universal, even among engineers.  I certainly do not lean toward one- > based indexing. Another engineer here who finds 0-based indexing more intuitive than 1-based indexing. -- Tim Rowe -- http://mail

Re: Python Goes Mercurial

2009-04-01 Thread Tim Daneliuk
Carl Banks wrote: > On Mar 31, 6:25 pm, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >> >> >> So what were these "strong antipathies" towards Git, exactly? > > Apparently Mercurial had it's own hate club, and the re

how to handle/generate pcap file

2009-04-01 Thread Evan
Hello - I'm trying to decode the pcap file which is packet capture by tcpdump or wireshark. Is there a python module that I can use it for this problem? Can python-libpcap or pycap or dpkt do that? On the other hand, I also generate some packets by dpkt module, can I also dump these packets t

Need a Python Training Class recommendation

2009-04-01 Thread greg
Hi guys, My company has offered to let me attend a week or so of python training in the New England area. I have looked around but can't seem to find a sit down course. Do you have any suggestions? I live in Manchester NH but would be willing to drive into Boston area. Any experiences, ideas or

Re: python for loop

2009-04-01 Thread Lou Pecora
In article <1ej5t4930m29h0f6ttpdcd83t08q2q3...@4ax.com>, Lada Kugis wrote: > On 01 Apr 2009 01:26:41 GMT, Steven D'Aprano > wrote: > > > > >Why Python (and other languages) count from zero instead of one, and > >why half-open intervals are better than closed intervals: > > > >http://www.johnd

Re: The spam to content ratio of this group

2009-04-01 Thread Steven D'Aprano
On Wed, 01 Apr 2009 06:43:48 -0700, Eric wrote: > is getting very high. Why aren't captcha's used to prevent all of this > noise? /me opens mouth to make sarcastic comment /me shuts mouth again That's like saying "There's a lot of oil slicks washing up onto the beach. Why don't we put more tra

Regex trouble

2009-04-01 Thread akshat agarwal
Hi, I am trying to use the following snippet of code to print a regex match. s = '01234567890123456789x012' pat = r'(.*?x|[^a]+)*y' mo = re.search(pat, s) if mo is not None: print mo.group(0) By adding one character before the 'x' in the input string, the time taken to print the match doub

Re: complaints about no replies last week

2009-04-01 Thread pruebauno
On Mar 31, 4:07 pm, Arnaud Delobelle wrote: > prueba...@latinmail.com writes: > > [...] > > > > > Well since I attracted a couple people's attention I will describe the > > problem in more detail. Describing the problem properly is probably as > > hard as solving it, so excuse me if I struggle a b

Default Tkinter Structure of a 640x480 PIL BMP File?

2009-04-01 Thread W. eWatson
See Subject. Does it have a header, DIB, palette, and data section? What is the default depth? -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet Web P

Re: python for loop

2009-04-01 Thread Lou Pecora
In article <72i5t4tgfo2h4gd6ggcs02flkca85kg...@4ax.com>, Lada Kugis wrote: > and > the (m-n) point Chris was trying to explain doesn't seem that relevant > to me. That's because you haven't done enough programming really using the Python structures and objects. You can really do a lot with

Re: python for loop

2009-04-01 Thread Lada Kugis
On Wed, 1 Apr 2009 00:40:17 -0700 (PDT), Carl Banks wrote: > >Lada, > >I am also an engineer, and I can tell your idea of intuitive is not >universal, even among engineers. I certainly do not lean toward one- >based indexing. > >From a programming standpoint--and remember Python is a programming

Re: List of paths

2009-04-01 Thread Nico Grubert
May be not so much pythonic, but works for i in range(len(q)): for x in q[i:]: if x.startswith(q[i]) and x!=q[i]: q.remove(x) ...but works fine. Thanks, Eugene. Also thanks to Andrew. Your example works fine, too. Thanks to remind me of the 'yield' statement! ;-) Regard

Re: python for loop

2009-04-01 Thread Lada Kugis
On 01 Apr 2009 08:06:28 GMT, Steven D'Aprano wrote: > >There are advantages and disadvantages to both systems, but on balance, I >think that zero-based is a better system for programming, and one-based >for natural language. Nicely put. Yes, along with some of your other arguments, I think I

comtypes CreateObject problem

2009-04-01 Thread Maria R
We get the following, less favourable respons :o( Any advice is greatly appreciated!! Setting is python 2.5.2, windows xp professional SP3, SolidEdge V20 SP10 We have success with comtypes interfacing other software like SmarTeam (PDM/PLM software) and of course Excel and alike. Thnx IDLE 1.2.2

Re: i have to change default tab length in pydev

2009-04-01 Thread Coonay
On Mar 31, 8:39 am, "Rhodri James" wrote: > > i understand that you get request token,and you need to get Access > > tokens after that, > > my question is about Access tokens:which mechanism  do u use to tore > > access tokens for future use > > I'm sorry, I have no idea what you're talking about

Re: Beazley on Generators

2009-04-01 Thread Kay Schluehr
On 1 Apr., 07:03, Terry Reedy wrote: > At PyCon2008, David Beazley presented an excellent talk on generators. > Generator Tricks for Systems > Programmershttp://www.dabeaz.com/generators/index.html > > At PyCon2009, he followed up with another talk on more advanced > generator usage, which Guido

Re: A design problem I met again and again.

2009-04-01 Thread 一首诗
I also think that's my best choice. Before I wrote my mail, I already knew that this is not a good question. It lacks details, and it is too big. But I think the first step to resolve a problem is to describe it. In that way, I might find the answer myself On Apr 1, 6:40 pm, "andrew cooke"

Re: A design problem I met again and again.

2009-04-01 Thread 一首诗
On Apr 1, 4:55 pm, Lawrence D'Oliveiro wrote: > In message <48506803-a6b9-432b-acef- > > b75f76e90...@v23g2000pro.googlegroups.com>, 一首诗 wrote: > > Until one day I find service has nearly 100 methods and 6000 lines of > > code.   I don't need to read any programming book to know that it's > > too

xml to xhtml

2009-04-01 Thread jud779
Hi, I have a data in xml file and i want to show this on html page and i am planning to put his on http server. I am exploring my options to show content of xml file. Consider me new with html and all i am looking to generate simple html page from xml data. Also, this xml file that i created was fr

Re: python for loop

2009-04-01 Thread MRAB
Lada Kugis wrote: [snip] Yes, that's it. I won't argue over it, since I can't change it, but 1 is still more natural to me (it is "the real world" way). The above pros seem to me to be very little compared to the cons of the ... and the (m-n) point Chris was trying to explain doesn't seem that re

Re: python for loop

2009-04-01 Thread MRAB
Steven D'Aprano wrote: On Wed, 01 Apr 2009 04:58:48 +0200, Lada Kugis wrote: Why do we try to create languages that are intuitive to humans, then ? Because of the foolish hope that sufficiently easy syntax will make excellent programmers out of average people. Programming is not intuitive

Re: Stripping non-numbers from a file parse without nested lists?

2009-04-01 Thread Lorenzo
Maybe you can try a regex, something like -- import re pattern = re.compile('^(\d+)/(\d+).*') def read_data(filename): fh = open(filename, "r", encoding="ascii") for line in fh: if pattern.match(line): dip_,dir_ = pattern.match(line).groups()

The spam to content ratio of this group

2009-04-01 Thread Eric
is getting very high. Why aren't captcha's used to prevent all of this noise? -- http://mail.python.org/mailman/listinfo/python-list

Re: The spam to content ratio of this group

2009-04-01 Thread Grant Edwards
On 2009-04-01, Eric wrote: > is getting very high. Why aren't captcha's used to prevent all of this > noise? 1) Captcha's don't work. 2) The NNTP protocol doesn't support Captcha's 3) Simply ignoring all posts made from Google Groups works quite well. -- Grant Edwards gr

Re: Regex trouble

2009-04-01 Thread andrew cooke
".*?" is a "not greedy" match, which is significantly more difficult to handle than a normal ".*". so the performance will depend on quite complex details of how the regular expression engine is implemented. it wouldn't surprise me if perl was better here, because it comes from a background with

Re: Regex trouble

2009-04-01 Thread andrew cooke
more exactly, my guess is perl has a special case for this that avoids doing a search over all possible matchers via the pushdown stack. andrew cooke wrote: > > ".*?" is a "not greedy" match, which is significantly more difficult to > handle than a normal ".*". so the performance will depend on

Re: List of paths

2009-04-01 Thread andrew cooke
Nico Grubert wrote: >> May be not so much pythonic, but works >> >> for i in range(len(q)): >> for x in q[i:]: >>if x.startswith(q[i]) and x!=q[i]: >>q.remove(x) > > ...but works fine. Thanks, Eugene. > Also thanks to Andrew. Your example works fine, too. Thanks to remind me

Re: Stripping non-numbers from a file parse without nested lists?

2009-04-01 Thread jay logan
On Apr 1, 2:35 am, daku9...@gmail.com wrote: > On Mar 31, 6:47 pm, "Rhodri James" > wrote: > > > What you're doing (pace error checking) seems fine for the data > > structures that you're using.  I'm not entirely clear what your usage > > pattern for "dip" and "dir" is once you've got them, so I c

Which is more Pythonic? (was: Detecting Binary content in files)

2009-04-01 Thread John Posner
Dennis Lee Bieber presented a code snippet with two consecutive statements that made me think, "I'd code this differently". So just for fun ... is Dennis's original statement or my "_alt" statement more idiomatically Pythonic? Are there even more Pythonic alternative codings? mrkrs = [b for b i

Re: python for loop

2009-04-01 Thread andrew cooke
MRAB wrote: > Steven D'Aprano wrote: >> On Wed, 01 Apr 2009 04:58:48 +0200, Lada Kugis wrote: >> >>> Why do we try to create languages that are intuitive to humans, then ? >> >> Because of the foolish hope that sufficiently easy syntax will make >> excellent programmers out of average people. >> >>

Re: Stripping non-numbers from a file parse without nested lists?

2009-04-01 Thread jay logan
On Apr 1, 11:05 am, jay logan wrote: > On Apr 1, 2:35 am, daku9...@gmail.com wrote: > > > > > On Mar 31, 6:47 pm, "Rhodri James" > > wrote: > > > > What you're doing (pace error checking) seems fine for the data > > > structures that you're using.  I'm not entirely clear what your usage > > > pat

Re: Beazley on Generators

2009-04-01 Thread andrew cooke
Kay Schluehr wrote: > There is just one thing I find disappointing. Since the talk is almost > a compendium of advanced uses of generators I'm missing a reference to > Peter Thatchers implementation of monads: > > http://www.valuedlessons.com/2008/01/monads-in-python-with-nice-syntax.html > > Peter

Re: xml to xhtml

2009-04-01 Thread Joe Riopel
On Wed, Apr 1, 2009 at 10:43 AM, wrote: > If anyone can give me some guidance what should be the best way to > generate html/xhtml page using python would be great. I am open to > other options like xsl or anything else that can make things simple. Since you're open to other options, I would tak

Re: The spam to content ratio of this group

2009-04-01 Thread skip
Eric> is getting very high. Why aren't captcha's used to prevent all of Eric> this noise? Steven> /me opens mouth to make sarcastic comment Steven> /me shuts mouth again Steven> That's like saying "There's a lot of oil slicks washing up onto Steven> the beach. Why don't w

Re: The spam to content ratio of this group

2009-04-01 Thread Tim Golden
s...@pobox.com wrote: Eric> is getting very high. Why aren't captcha's used to prevent all of Eric> this noise? Steven> /me opens mouth to make sarcastic comment Steven> /me shuts mouth again Steven> That's like saying "There's a lot of oil slicks washing up onto Steven>

Re: List of paths

2009-04-01 Thread Eugene Perederey
Sure, generators rock! :-) 2009/4/1 andrew cooke : > Nico Grubert wrote: >>> May be not so much pythonic, but works >>> >>> for i in range(len(q)): >>>     for x in q[i:]: >>>        if x.startswith(q[i]) and x!=q[i]: >>>            q.remove(x) >> >> ...but works fine. Thanks, Eugene. >> Also th

Re: A design problem I met again and again.

2009-04-01 Thread Jeremiah Dodds
On Wed, Apr 1, 2009 at 3:40 PM, 一首诗 wrote: > What are the average size of source files in your project? If it's > far lower than 15,000, don't feel it's a little unbalance? > -- > http://mail.python.org/mailman/listinfo/python-list > While I think 15,000 is, in the vast majority of cases, qu

Matrix operations on character matrix element?

2009-04-01 Thread olusina eric
I hope somebody will be able to help me here. I am trying to solve some physical problems that will require the generation of some function in terms of some parameters. These functions are derived from matrix operation on “characters”. Are there ways numpy/scipy perform matrix operations on cha

Re: Which is more Pythonic? (was: Detecting Binary content in files)

2009-04-01 Thread bieffe62
On Apr 1, 5:10 pm, John Posner wrote: > Dennis Lee Bieber presented a code snippet with two consecutive statements > that made me think, "I'd code this differently". So just for fun ... is > Dennis's original statement or my "_alt" statement more idiomatically > Pythonic? Are there even more Pytho

Re: Beazley on Generators

2009-04-01 Thread Peter Pearson
On Wed, 01 Apr 2009 01:03:50 -0400, Terry Reedy wrote: > At PyCon2008, David Beazley presented an excellent talk on generators. > Generator Tricks for Systems Programmers > http://www.dabeaz.com/generators/index.html > > At PyCon2009, he followed up with another talk on more advanced > generator

Creating a Python Module - Available Implementations

2009-04-01 Thread ntwrkd
I have been browsing through creating a Python module for common custom functions that I frequently use, but I am wondering, is this the best method, and is it necessary? Really all I need is to import functions from another plaintext Python source file, how might I do this? What would merit the ne

Re: python for loop

2009-04-01 Thread Carl Banks
On Apr 1, 7:08 am, Lada Kugis wrote: > On Wed, 1 Apr 2009 00:40:17 -0700 (PDT), Carl Banks > > > > > > wrote: > > >Lada, > > >I am also an engineer, and I can tell your idea of intuitive is not > >universal, even among engineers.  I certainly do not lean toward one- > >based indexing. > > >From a

Re: python for loop

2009-04-01 Thread MRAB
andrew cooke wrote: MRAB wrote: Steven D'Aprano wrote: On Wed, 01 Apr 2009 04:58:48 +0200, Lada Kugis wrote: Why do we try to create languages that are intuitive to humans, then ? Because of the foolish hope that sufficiently easy syntax will make excellent programmers out of average people.

double/float precision question

2009-04-01 Thread TP
Hi everybody, Try the following python statements: >>> "%.40f" % 0.222 '0.098864108374982606619596' >>> float( 0.222) 0.1 It seems the first result is the same than the following C program: #

Re: The spam to content ratio of this group

2009-04-01 Thread r
On Apr 1, 9:57 am, Grant Edwards wrote: > On 2009-04-01, Eric wrote: > 3) Simply ignoring all posts made from Google Groups works >    quite well. Yea, there's no spam in Usenet land APRIL FOOLS -- http://mail.python.org/mailman/listinfo/python-list

league problem in python

2009-04-01 Thread Ross
I'm new to programming and have chosen Python as my first language. I've gone through Allen Downey's Think Python book and I think I'm ready to dive into a project. The first problem I've chosen to tackle is a problem I have seen at my tennis club. Each spring/fall, the pro puts out a sheet of pape

RE: Which is more Pythonic? (was: Detecting Binary content in files)

2009-04-01 Thread John Posner
>> >    mrkrs_alt2 = filter(lambda b: b > 127 or b in list("\r\n\t"), block) >> > >> >> Never tested my 'pythonicity', but I would do: >> >> def test(b) : b > 127 or b in r"\r\n\t" Oops! Clearly, b in "\r\n\t" is preferable to ... b in list("\r\n\t") You do *not* want to u

Re: Thoughts on language-level configuration support?

2009-04-01 Thread Aaron Brady
On Apr 1, 6:29 am, jfager wrote: > On Apr 1, 3:29 am, Kay Schluehr wrote: > > > > "Discoverable", as in built-in tools that let you have the following > > > conversation:  "Program, tell me all the things I can configure about > > > you" - "Okay, here they all are".  No digging through the source

Re: python for loop

2009-04-01 Thread Mensanator
On Apr 1, 9:08 am, Lada Kugis wrote: > On Wed, 1 Apr 2009 00:40:17 -0700 (PDT), Carl Banks > > > > > > wrote: > > >Lada, > > >I am also an engineer, and I can tell your idea of intuitive is not > >universal, even among engineers.  I certainly do not lean toward one- > >based indexing. > > >From a

Re: double/float precision question

2009-04-01 Thread Mensanator
On Apr 1, 12:13 pm, TP wrote: > Hi everybody, > > Try the following python statements: > > >>> "%.40f" % 0.222 > > '0.098864108374982606619596'>>> float( > 0.222) > > 0.1 > > It seems the first result is the s

Re: league problem in python

2009-04-01 Thread bearophileHUGS
Ross: > How should I go about starting this problem...I'm feel like this is a > really simple problem, but I'm having writer's/coder's block. Can you > guys help? There are refined ways to design a program, but this sounds like a simple and small one, so you probably don't need much formal things

Re: python for loop

2009-04-01 Thread Lou Pecora
In article <91t6t4hfjicgvdrcgkhdjfro3ko3ktu...@4ax.com>, Lada Kugis wrote: > On Wed, 1 Apr 2009 00:40:17 -0700 (PDT), Carl Banks > wrote: > > > > >Lada, > > > >I am also an engineer, and I can tell your idea of intuitive is not > >universal, even among engineers. I certainly do not lean towar

Re: Creating a Python Module - Available Implementations

2009-04-01 Thread Dave Angel
A python source file *is* a module. And you import it the same way you import any of the system modules. Just use the basename, without the .py extension. import mylib The only catch is where you locate this module. When you first write it, just put it in the same directory as your script

Re: A design problem I met again and again.

2009-04-01 Thread Nick Craig-Wood
一首诗 wrote: > But I think the first step to resolve a problem is to describe it. In > that way, I might find the answer myself :-) That is a great saying! To answer your original question, split your code up into sections that can be tested independently. If you can test code in a isolated wa

Re: List of paths

2009-04-01 Thread Paul McGuire
On Apr 1, 3:57 am, Nico Grubert wrote: > Dear Python developers > > I have the following (sorted) list. > ['/notebook', >   '/notebook/mac', >   '/notebook/mac/macbook', >   '/notebook/mac/macbookpro', >   '/notebook/pc', >   '/notebook/pc/lenovo', >   '/notebook/pc/hp', >   '/notebook/pc/sony', >

Re: double/float precision question

2009-04-01 Thread Dave Angel
It's not at all clear what you really want. You say you want to "use" the %e format, but then imply you're then going to turn it back into a float. Since I don't know what the end goal is, I'll just comment generally. All Python floating point is equivalent to the 'double' type of the C imp

[Ann] New super python vm

2009-04-01 Thread El Loco
Hi all, This is to announce that right after a few weeks after our first coding sprint, our project, "Unswallowed-snot", has already achieved substantial results. In our tests, runtime performance shows a 150x slowdown. This is due mainly to our lead developer (myself) still not knowing enough pyt

Re: New super python vm

2009-04-01 Thread r
On Apr 1, 1:55 pm, El Loco wrote: > Hi all, > > This is to announce that right after a few weeks after our first > coding sprint, > our project, "Unswallowed-snot", has already achieved substantial > results. > In our tests, runtime performance shows a 150x slowdown. > This is due mainly to our le

Re: league problem in python

2009-04-01 Thread r
On Apr 1, 12:35 pm, Ross wrote: [snip] > How should I go about starting this problem...I'm feel like this is a > really simple problem, but I'm having writer's/coder's block. Can you > guys help? Ross, I highly disagree with bear on this. What you have here is a 90 percent math problem and a 10 p

Re: A design problem I met again and again.

2009-04-01 Thread Martin P. Hellwig
一首诗 wrote: But I think the first step to resolve a problem is to describe it. In that way, I might find the answer myself That is an excellent approach, knowing you have a problem and describing it is actually the hardest part of a design, the rest is more like a puzzle. What I guess so fa

imp.load_source() - explanation needed

2009-04-01 Thread mynthon
Hi! I need help. I don't understand what doc says. I load module from path testmod/mytest.py using imp.load_source(). My code is import imp testmod = imp.load_source('koko', 'testmod/mytest.py) print testmod but i don't understand whatt is first (name) argument for. Docs says that "The name arg

Converting a PIL image object to a buffer

2009-04-01 Thread Simon Hibbs
I'm trying to dump a snapshot of my application window to the clipboard. I can use ImageGrab in PIL to get the screen data into a PIL image object, which i have converted to a bitmap using ImageWin, but when I try to pass this to the clipboard using - win32clipboard.SetClipboardData(win32clipboard

Re: Stripping non-numbers from a file parse without nested lists?

2009-04-01 Thread daku9999
On Apr 1, 8:10 am, jay logan wrote: > On Apr 1, 11:05 am, jay logan wrote: > > > > > On Apr 1, 2:35 am, daku9...@gmail.com wrote: > > > > On Mar 31, 6:47 pm, "Rhodri James" > > > wrote: > > > > > What you're doing (pace error checking) seems fine for the data > > > > structures that you're using

Re: imp.load_source() - explanation needed

2009-04-01 Thread Albert Hopkins
On Wed, 2009-04-01 at 12:17 -0700, mynthon wrote: > Hi! > > I need help. I don't understand what doc says. > > I load module from path testmod/mytest.py using imp.load_source(). My > code is > > import imp > testmod = imp.load_source('koko', 'testmod/mytest.py) > print testmod > > but i don't u

Re: double/float precision question

2009-04-01 Thread Nick Craig-Wood
TP wrote: > Hi everybody, > > Try the following python statements: > > >>> "%.40f" % 0.222 > '0.098864108374982606619596' > >>> float( 0.222) > 0.1 > > It seems the first result is the same than the fol

Demographic Information about Python

2009-04-01 Thread Betiana Krancenblum
Hi, I'm looking for statistical information about where Python is beeing used as a programming language and where it is teached as a language for beginner programmers. Where do you think I can find that information? Thanks, Betiana __

Re: Converting a PIL image object to a buffer

2009-04-01 Thread Gary Herron
Simon Hibbs wrote: I'm trying to dump a snapshot of my application window to the clipboard. I can use ImageGrab in PIL to get the screen data into a PIL image object, which i have converted to a bitmap using ImageWin, but when I try to pass this to the clipboard using - win32clipboard.SetClipboa

py2exe problem

2009-04-01 Thread Wolfgang Forstmeier
Hey list, what kind of error do I have with getting this error at starting my app. Im am not using IdleConf.GetOption right now. Warning: configHandler.py - IdleConf.GetOption - problem retrieving configration option 'name' from section 'Keys'. returning default value: '' -- http://mail.pyth

Re: Demographic Information about Python

2009-04-01 Thread Chris Rebert
2009/4/1 Betiana Krancenblum : > Hi, > > I'm looking for statistical information about where Python is beeing used as > a programming language and where it is teached as a language for beginner > programmers. > Where do you think I can find that information? I don't think there are any statistics

Alpha/For Discussion: RPMs for around 3,000 PyPI packages.

2009-04-01 Thread Sean Reifschneider
At PyCon I got this idea in my head to try building packages for everything in the cheeseshop. I've had some success, getting over 3,000 packages built on Fedora 10 (and fewer on CentOS 5 and fewer still on 4). This is out of 6176 packages. I've made these initial packages, which should be consi

Re: Alpha/For Discussion: RPMs for around 3,000 PyPI packages.

2009-04-01 Thread andrew cooke
Sean Reifschneider wrote: > At PyCon I got this idea in my head to try building packages for > everything > in the cheeseshop. I've had some success, getting over 3,000 packages > built on Fedora 10 (and fewer on CentOS 5 and fewer still on 4). This is > out of 6176 packages. neat idea. the inf

  1   2   >