John Posner added the comment:
Per Martin's suggestion, deltas from issue21279.v5.patch:
* no change to patch for doc/library/stdtypes.rst
* doc string reflowed in patch for objects/unicodeobject.c
--
Added file: http://bugs.python.org/file37855/issue21279.v6.patch
John Posner added the comment:
issue21279.v5.patch tries to apply the comments in msg233013, msg233014, and
msg233025 to the Doc/library/stdtypes.rst writeup. Then it applies some of the
same language to the docstring in Objects/unicodeobject.c.
--
Added file: http://bugs.python.org
John Posner added the comment:
Patch of 12-21 looks good, Martin.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21279
___
___
Python-bugs-list
John Posner added the comment:
Regarding Martin's patch of 12-18:
stdtypes.rst -- looks good to me
unicodeobject.c -- I suggest changing this sentence:
If a character is not in the table, the subscript operation should raise
LookupError, and the character is left untouched
John Posner added the comment:
Kindly ignore message #2 on the Rietveld page (sorry for the channel noise).
Here's my suggested revision:
Return a copy of the string *str* in which each character has been mapped
through the given translation *table*. The table must be a subscriptable
object
Peter Otten wrote:
Last not least there's the option to employ locale-aware formatting:
Not quite last ... there's the mind-bending regular expression route:
import re
re.sub(r(?=\d)(?=(\d\d\d)+$), ,, 12345678) # 12,345,678
re.sub(r(?=\d)(?=(\d\d\d)+$), ,, -54321) # -54,321
On 7/16/2012 12:28 PM, tinn...@isbd.co.uk wrote:
tinn...@isbd.co.uk wrote:
I am trying to use the PyQt4 calendar widget to perform some different
actions on specific dates. There are three events available:-
selectionChanged()
activated(QDate)
clicked(QDate)
On trying all
On 4/4/2012 7:32 PM, Chris Angelico wrote:
Don't know if it's what's meant on that page by the += operator,
Yes, it is.
a=([1],)
a[0].append(2) # This is fine
[In the following, I use the term name rather loosely.]
The append() method attempts to modify the object whose name is a[0].
That
On 2:59 PM, Devin Jeanpierre wrote:
It is kind of funny that the docs don't ever explicitly say what a
property is. http://docs.python.org/library/functions.html#property --
Devin
Here's a writeup that does:
http://wiki.python.org/moin/AlternativeDescriptionOfProperty
-John
--
On 2:59 PM, noydb wrote:
How do you format a number to print with commas?
I would readily admit that both the locale module and format method
are preferable to this regular expression, which certainly violates the
readability counts dictum:
r(?=\d)(?=(\d\d\d)+$)
# python 2.6.6
import re
Jabba Laci wrote:
Hi, Thanks for your reply. I forgot to mention that my first solution
created a headless browser, i.e. it didn't create any GUI. I would
like to keep it that way, thus I could scrape (AJAX-powered) webpages
in batch mode without any user interaction.
No head, no problem.
Jabba Laci wrote:
Hi,
I have a simple PyQt application that creates a webkit instance to
scrape AJAX web pages. It works well but I can't call it twice. I
think the application is not closed correctly, that's why the 2nd call
fails. Here is the code below. I also put it on pastebin:
On 2:59 PM, Chris Angelico wrote:
So really, it's not all() is slow but function calls are slow.
Maybe it'd be worthwhile making an all-factory:
PLEASE say you're joking. If I saw code like that on any of our project,
this would definitely qualify for a DailyWTF.
For the benefit of anyone
On 2:59 PM, Nobody wrote:
On Tue, 16 Aug 2011 01:26:54 +0200, Johannes wrote:
what is the best way to check if a given list (lets call it l1) is
totally contained in a second list (l2)?
Best is subjective. AFAIK, the theoretically-optimal algorithm is
Boyer-Moore. But that would require a
On 2:59 PM, Nobody wrote:
On Tue, 16 Aug 2011 01:26:54 +0200, Johannes wrote:
what is the best way to check if a given list (lets call it l1) is
totally contained in a second list (l2)?
Best is subjective. AFAIK, the theoretically-optimal algorithm is
Boyer-Moore. But that would require a
On 2:59 PM, smith jack wrote:
if a list L is composed with tuple consists of two elements, that is
L = [(a1, b1), (a2, b2) ... (an, bn)]
is there any simple way to divide this list into two separate lists , such
that
L1 = [a1, a2... an]
L2=[b1,b2 ... bn]
i do not want to use loop, any
On 2:59 PM, smith jack wrote:
if a list L is composed with tuple consists of two elements, that is
L = [(a1, b1), (a2, b2) ... (an, bn)]
is there any simple way to divide this list into two separate lists , such
that
L1 = [a1, a2... an]
L2=[b1,b2 ... bn]
i do not want to use loop, any
On 2:59 PM, Kevin Walzer wrote:
Can anyone point me in the direction of a Tkinter/Python app that has
been wrapped with py2exe and is deployed on Windows as a standalone
using one of the standard installer tools? (MSI, NSIS, Inno Setup,
etc.) I'm working on a Tkinter app for Windows and have
On 2:59 PM, Kevin Walzer wrote:
Can anyone point me in the direction of a Tkinter/Python app that has
been wrapped with py2exe and is deployed on Windows as a standalone
using one of the standard installer tools? (MSI, NSIS, Inno Setup,
etc.) I'm working on a Tkinter app for Windows and have
On 2:59 PM, Anthony Kong wrote:
snip
So the question: is it possible to use lambda expression at all for
the setter? (As in the last, commented-out line)
Python interpreter will throw an exception right there if I use the
last line ('SyntaxError: lambda cannot contain assignment'). I'd use
On 2:59 PM, Ethan Furman wrote:
snip
def __call__(self, func=None):
if func is None:
return self._call()
self.func = func
return self
def _call(self):
print(\n + self.char * 50)
self.func()
print(self.char * 50 + '\n')
On 2:59 PM, Lie Ryan wrote:
Can any of you guys explain me advantages and disadvantages of
using each of them
Simplicity is one, using @decor() means you have at least three-level
nested functions, which means the code is likely to be very huge and
perhaps unnecessarily.
Bruce Eckel pointed
Friedrich:
snip
I would be much obliged if someone can give me some tips on how to
achieve a variably pad a number.
:)
('%%0%dd' % (pads,)) % (n,)
Probably be good to wrap it in a function. It looks kind of obscure as it
is.
You might want to try new style string formatting [1], which
On 2:59 PM, Ian Kelly wrote:
On Sat, Jun 4, 2011 at 12:09 PM, Chris Angelico ros...@gmail.com wrote:
Python doesn't seem to have an inbuilt function to divide strings in
this way. At least, I can't find it (except the special case where n
is 1, which is simply 'list(string)'). Pike allows you
On 5/13/2011 3:38 PM, noydb wrote:
I want some code to take the items in a semi-colon-delimted string
list and places each in a python list. I came up with below. In
the name of learning how to do things properly,
No big deal that you weren't aware of the split() method for strings.
Since
On 2:59 PM, Massi wrote:
I everyone,
I'm trying to write a setup file for py2exe (0.6.9) to convert my
script into a windows (on win 7) executable. In my script (python2.6)
I use PyQt and matplotlib. Here is the setup.py file:
snip
ImportError: No module named Tkinter
Obviously Tkinter is
I've started working, as a tech writer, for a Spanish software
configuration management company. And I'm investigating the idea of
releasing a user manual in the form of a wiki that supports
paragraph-by-paragraph commenting.
I looked at Django Book [1][2], but it's not clear to me how much
On 11/9/2010 3:44 PM, Gregory Ewing wrote:
I don’t get it.
I get it. Does that mean that I don't get it?
Yes. As Dr. Feynman said about quantum mechanics.
-John
--
http://mail.python.org/mailman/listinfo/python-list
On 11/9/2010 1:43 PM, Terry Reedy wrote:
... List *is* useful as an initializer for
collecitons.defaultdicts.
And it was useful when several members of this forum helped me to
develop a prime-number generator.
See http://www.mail-archive.com/python-list@python.org/msg288128.html.
(I meant
On 10/28/2010 12:16 PM, cbr...@cbrownsystems.com wrote:
It's clear but tedious to write:
if 'monday in days_off or tuesday in days_off:
doSomething
I currently am tending to write:
if any([d for d in ['monday', 'tuesday'] if d in days_off]):
doSomething
Is there a better pythonic
On 10/20/2010 9:59 AM, Lucasm wrote:
snip
Thanks for the answers. I would like to override the property though
without making special modifications in the main class beforehand. Is
this possible?
Take a look at http://docs.python.org/reference/datamodel.html#descriptors
The last paragraph
On 10/19/2010 9:39 AM, Lucasm wrote:
Hi,
A question. Is it possible to dynamically override a property?
class A(object):
@property
def return_five(self):
return 5
I would like to override the property for an instance of A to say the
string 'bla'.
Is this the sort of thing
On 10/15/2010 6:59 AM, Christopher Steele wrote:
Thanks,
The issue with the times is now sorted, however I'm running into a
problem towards the end of the script:
File sortoutsynop2.py, line 131, in module
newline =
message_type+c+str(station_id)+c+newtime+c+lat+c+lon+c+c+-+c+
002
On 10/14/2010 6:08 AM, Christopher Steele wrote:
Hi
I've been trying to decode a series of observations from multiple files
(each file is a different time) and put each type of observation into
their own separate file. The script runs successfully for one file but
whenever I try it for more
On 10/14/2010 10:44 AM, Christopher Steele wrote:
The issue is that I need to be able to both, split the names of the
files so that I can extract the relevant times, and open each
individual file and process each line individually. Once I have
achieved this I need to append the sorted files
On 10/10/2010 7:02 PM, Steven D'Aprano wrote:
On Sun, 10 Oct 2010 18:14:33 -0400, John Posner wrote:
Class attributes are often used as class constants, so how about
naming them with UPPERCASE names, like other constants? When you choose
to override one of these constants, like
.
meal = SpamMeal()
meal.EGGS = 4
meal.Report()# This meal includes 4 eggs.
#
-John Posner
--
http://mail.python.org/mailman/listinfo/python-list
On 9/24/2010 4:21 AM, Peter Otten wrote:
If you are not interested in the position of the substr use the in
operator:
if substr in s:
print found
else:
print not found
Another missing feature candidate: sublist
'bc' in 'abcde'
True
list('bc') in list('abcde')
False
On 9/24/2010 2:45 PM, Tim Chase wrote:
On 09/24/10 13:01, Ethan Furman wrote:
John Posner wrote:
Another missing feature candidate: sublist
'bc' in 'abcde'
True
list('bc') in list('abcde')
False
I'm not aware of any idioms, but how about a simple function?
snip
Foldable into a one
On 8/18/2010 1:38 PM, cbr...@cbrownsystems.com wrote:
To go the other way, if d = 1, then there exists integers (not
neccessarily positive) such that
a*x + b*y + c*z = 1
That fact is non-trivial, although the proof isn't *too* hard [1]. I
found it interesting to demonstrate the simpler
On 8/16/2010 12:44 PM, Alex van der Spek wrote:
Anybody catches any other ways to improve my program (attached), you are
most welcome.
1. You don't need to separate out special characters (TABs, NEWLINEs,
etc.) in a string. So:
On 8/16/2010 4:18 PM, Baba wrote:
packages=[2,103,105]
min_size=min(packages[0],packages[1],packages[2])
or:
min_size = min(packages)
-John
--
http://mail.python.org/mailman/listinfo/python-list
On 8/15/2010 11:38 AM, Baba wrote:
In addition to the points that Emile and Ian made ...
def diophantine_nuggets(x,y,z):
cbc=0 #cbc=can_buy counter
packages =[x,y,z]
You can take advantage of a nifty syntax convenience feature here.
Instead of loading all of the function's
On 8/14/2010 10:52 AM, Baba wrote:
for n_nuggets in range(50):
result1 = can_buy(n_nuggets)
result2 = can_buy(n_nuggets+1)
result3 = can_buy(n_nuggets+2)
result4 = can_buy(n_nuggets+3)
result5 = can_buy(n_nuggets+4)
result6 = can_buy(n_nuggets+5)
if
On 8/13/2010 6:25 AM, Roald de Vries wrote:
On Aug 12, 2010, at 10:51 PM, John Posner wrote:
On 8/12/2010 9:22 AM, Dave Angel wrote:
Now you have to find the largest number below 120, which you can
easily do with brute force
tgt = 120 # thanks, Dave Angel
Anytime, but I'm not Dave Angel
On 8/12/2010 9:22 AM, Dave Angel wrote:
Now you have to find the largest number below 120, which you can
easily do with brute force
Dept of overkill, iterators/generators division ...
-John
#--
from itertools import imap, product, ifilter
from operator import mul
box_sizes
On 8/12/2010 6:31 PM, News123 wrote:
candidate_box_counts = product(
xrange(target/box_sizes[0] + 1),
xrange(target/box_sizes[1] + 1),
xrange(target/box_sizes[2] + 1),
)
Couldn't this be rewritten as:
candidate_box_counts = product(
* [
John Posner jjpos...@optimum.net added the comment:
I think it would be confusing to create of subclass of defaultdict, defining a
__missing__ method in that subclass. The existence of the __missing__ method
would cancel the main functionality of the defaultdict object: invoking the
default
John Posner jjpos...@optimum.net added the comment:
On python-list, Wolfram Hinderer objected to the proposed patch's calling
__missing__ a special method.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9536
Changes by John Posner jjpos...@optimum.net:
--
status: open - pending
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9536
___
___
Python-bugs-list
On 8/2/2010 11:00 PM, John Posner wrote:
On 7/31/2010 1:31 PM, John Posner wrote:
Caveat -- there's another description of defaultdict here:
http://docs.python.org/library/collections.html#collections.defaultdict
... and it's bogus. This other description claims that __missing__ is a
method
On 8/6/2010 6:24 PM, Wolfram Hinderer wrote:
This is probably nitpicking, but the patch calls __missing__ a special
method. However, unlike special methods, it is not invoked by special
syntax but by the dict's __getitem__ method. (len() invokes __len__
on any object - you can't do something
New submission from John Posner jjpos...@optimum.net:
The documentation for collections.defaultdict is confusing with respect to the
__missing__ method. The fact is that a programmer using defaultdict does not
need to know anything about __missing__.
The attached patch contains a rewrite
On 8/5/2010 12:33 AM, John Nagle wrote:
There's got to be a better way to do this:
def editmoney(n) :
return((,.join(reduce(lambda lst, item : (lst + [item]) if
item else lst,
re.split(r'(\d\d\d)',str(n)[::-1]),[])))[::-1])
Here's a more elegant variant, using regexp lookahead:
def
On 8/5/2010 12:36 PM, MRAB wrote:
You don't need to reverse the string:
def thous_format(integer_string):
add comma thousands separator(s) to an integer-valued string
return re.sub(r(?=\d)(?=(?:\d\d\d)+$), ,, integer_string)
Nice! My first encounter with a look-behind! It
On 8/3/2010 12:54 PM, Ethan Furman wrote:
snip
I think mentioning how __missing__ plays into all this would be helpful.
Perhaps in the first paragraph, after the colon:
if a key does not currently exist in a defaultdict object, __missing__
will be called with that key, which in turn will call
On 8/3/2010 5:47 PM, Christian Heimes wrote:
So I'd rather not mention __missing__ in the first paragraph, which
describes the functionality provided *by* the defaultdict class. How
about adding this para at the end:
defaultdict is defined using functionality that is available to *any*
On 8/3/2010 6:48 PM, Ethan Furman wrote:
Christian Heimes wrote:
I just went and read the entry that had the bogus claim --
personally, I didn't see any confusion. I would like to point out the
__missing__ is *not* part of dicts (tested on 2.5 and 2.6 -- don't
have 2.7 installed yet).
I beg
On 7/31/2010 1:31 PM, John Posner wrote:
Caveat -- there's another description of defaultdict here:
http://docs.python.org/library/collections.html#collections.defaultdict
... and it's bogus. This other description claims that __missing__ is a
method of defaultdict, not of dict.
Following
On 7/31/2010 2:00 PM, Christian Heimes wrote:
Your answer is confusing even me. ;)
Yeah, I get that a lot. :-)
Let me try an easier to understand explanation. defaultdict *implements*
__missing__() to provide the default dict behavior.
In my experience, the word *implements* is commonly
On 7/31/2010 11:08 AM, Christian Heimes wrote:
... All you have to do is subclass dict and implement a
__missing__ method. See
http://docs.python.org/library/stdtypes.html?highlight=__missing__#mapping-types-dict
Caveat -- there's another description of defaultdict here:
On 7/14/2010 12:06 PM, Ethan Furman wrote:
... Have you tried this?
-- def foo():
... print locals()
... blah = 'interesting'
... print locals()
...
-- foo()
{}
{'blah': 'interesting'}
As can be clearly seen, blah does not exist before the assignment -- the
*name* blah has not been *bound* to
On 7/2/2010 11:20 AM, Michael Torrie wrote:
On 07/01/2010 08:57 AM, Alan wrote:
I know drag drop is not possible with TK.
Is this a Python Tk limitation or a Tk limitation in general? Google
suggests that Tk itself supports some form of dnd.
Which widget could I use for my
python
On 6/29/2010 12:51 PM, Thomas Jollans wrote:
def rprimes():
def elim_mult(n):
yield n
for p in filter((lambda x:x%n != 0), elim_mult(n+1)): yield p
yield 1
for p in elim_mult(2): yield p
Thomas, take a look at the thread Generators/iterators, Pythonicity,
On 5/27/2010 9:14 AM, Neil Cerutti wrote:
On 2010-05-27, eb303eric.brunel.pragma...@gmail.com wrote:
I've been using Python properties quite a lot lately and I've
found a few things that are a bit annoying about them in some
cases. I wondered if I missed something or if anybody else has
this
On 5/18/2010 4:54 PM, Chris Rebert wrote:
snip
Suggested reading: http://docs.python.org/library/functions.html#property
I've placed a revision to this official *property* documentation at:
http://wiki.python.org/moin/AlternativeDescriptionOfProperty
There's also a gentle (I hope) intro
On 5/19/2010 5:51 PM, Steven D'Aprano wrote:
On Wed, 19 May 2010 21:58:04 +0200, superpollo wrote:
Rather than iterating over an index j = 0, 1, 2, ... and then fetching
the jth character of the string, you can iterate over the characters
directly. So the inner loop is better written:
for c
On 5/18/2010 4:15 PM, Art wrote:
If I am in Pdb, I would like to set a temporary variable, for example:
(Pdb) r = 1
The 'r' gets interpreted as 'return' by Pdb.
Is there a Pdb instruction that guarantees the intended effect, like:
(Pdb) let r = 1
I can usually avoid using such variable
John Posner jjpos...@optimum.net added the comment:
Georg, your change (r79587) makes this the main definition:
generator
A function which returns an iterator.
I'm concerned that this definition does not fit well with the occurrence of
generator object in the following:
Python
John Posner jjpos...@optimum.net added the comment:
Fair enough, Georg. Case closed.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8012
On 3/22/2010 11:44 AM, Bruno Desthuilliers wrote:
snip
Another (better IMHO) solution is to use a plain property, and store the
computed value as an implementation attribute :
@property
def foo(self):
cached = self.__dict__.get('_foo_cache')
if cached is None:
self._foo_cache = cached =
On 3/21/2010 5:34 PM, Aahz wrote:
In articlemailman.555.1268232321.23598.python-l...@python.org,
John Posnerjjpos...@optimum.net wrote:
Bruno (and anyone else interested) --
As I promised/threatened, here's the *start* of a write-up on
properties, aimed at non-advanced Python programmers:
On 3/10/2010 8:37 PM, Gabriel Genellina wrote:
En Wed, 10 Mar 2010 11:45:38 -0300, John Posner jjpos...@optimum.net
escribió:
As I promised/threatened, here's the *start* of a write-up on
properties, aimed at non-advanced Python programmers:
http://www.jjposner.net/media/python-properties
On 3/11/2010 6:16 PM, gundlach wrote:
I *know* this already exists, but I can't remember where:
def pivot(func, seq):
# I know, a good implementation shouldn't call func() twice per item
return ( (x for x in seq if func(x)), (x for x in seq if not
func(x)) )
I feel like I read a thread
[ cross-posting to edu-sig ]
Bruno (and anyone else interested) --
As I promised/threatened, here's the *start* of a write-up on
properties, aimed at non-advanced Python programmers:
http://www.jjposner.net/media/python-properties-0310.pdf
I'm interested in corrections, of course. But I'm
On 3/8/2010 11:55 PM, Gary Herron wrote:
snip
The form of import you are using
from helpers import mostRecent
makes a *new* binding to the value in the module that's doing the
import.
snip
What you can do, is not make a separate binding, but reach into the
helpers module to get the value
On 3/9/2010 9:48 AM, Bruno Desthuilliers wrote:
John Posner a écrit :
On 3/8/2010 11:55 PM, Gary Herron wrote:
snip
The form of import you are using
from helpers import mostRecent
makes a *new* binding to the value in the module that's doing the
import.
snip
What you can do, is not make
On 3/8/2010 5:34 PM, dimitri pater - serpia wrote:
Hi,
I have two related lists:
x = [1 ,2, 8, 5, 0, 7]
y = ['a', 'a', 'b', 'c', 'c', 'c' ]
what I need is a list representing the mean value of 'a', 'b' and 'c'
while maintaining the number of items (len):
w = [1.5, 1.5, 8, 4, 4, 4]
I have
On 3/8/2010 9:39 PM, John Posner wrote:
snip
# gather data
tally_dict = defaultdict(Tally)
for i in range(len(x)):
obj = tally_dict[y[i]]
obj.id = y[i] --- statement redundant, remove it
obj.total += x[i]
obj.count += 1
-John
--
http://mail.python.org/mailman/listinfo
On 3/8/2010 9:43 PM, John Posner wrote:
On 3/8/2010 9:39 PM, John Posner wrote:
snip
obj.id = y[i] --- statement redundant, remove it
Sorry for the thrashing! It's more correct to say that the Tally class
doesn't require an id attribute at all. So the code becomes:
#-
from
On 3/7/2010 10:05 AM, vsoler wrote:
Hello,
My script starts like this:
book=readFromExcelRange('book')
house=readFromExcelRange('house')
table=readFromExcelRange('table')
read=readFromExcelRange('read')
...
But I would like to have something equivalent, like...
On 3/7/2010 10:59 AM, vsoler wrote:
Thank you for your help. Perhaps the solution you are suggesting is
not exactly what I was looking for, but helped anyway.
Oops, I was thinking list, not dict. Too fast, and not enough coffee!
-John
--
http://mail.python.org/mailman/listinfo/python-list
On 3/5/2010 7:15 AM, Bruno Desthuilliers wrote:
John Posner a écrit :
On 3/3/2010 6:56 PM, John Posner wrote:
... I was thinking
today about doing a Bruno, and producing similar pieces on:
* properties created with the @property decorator
* the descriptor protocol
I'll try to produce
On 3/4/2010 5:59 AM, Bruno Desthuilliers wrote:
I have two small ideas for improvement: - Swap the first two
paragraphs. First say what it is, and then give the motivation.
Mmm... As far as I'm concerned, I like it the way its. John ?
I think it doesn't make very much difference. But in the
On 3/3/2010 6:56 PM, John Posner wrote:
... I was thinking
today about doing a Bruno, and producing similar pieces on:
* properties created with the @property decorator
* the descriptor protocol
I'll try to produce something over the next couple of days.
Starting to think about a writeup
On 3/3/2010 5:56 AM, Bruno Desthuilliers wrote:
Eike Welk a écrit :
John Posner wrote:
I've updated the text at this location:
http://cl1p.net/bruno_0301.rst/
I think this is a very useful writeup!
It would be perfect with a little bit of introduction that says:
1. - What it is: The rough
On 3/3/2010 9:58 AM, John Posner wrote:
Film at 11,
John
Done -- see http://wiki.python.org/moin/FromFunctionToMethod
-John
--
http://mail.python.org/mailman/listinfo/python-list
On 3/3/2010 10:48 AM, Bruno Desthuilliers wrote:
I spotted this:
http://www.python.org/doc/faq/programming/#what-is-a-method
http://www.python.org/doc/faq/general/#why-must-self-be-used-explicitly-in-method-definitions-and-calls
Our text is probably a bit too long for a direct inclusion in
On 3/3/2010 6:33 PM, Eike Welk wrote:
I have two small ideas for improvement:
- Swap the first two paragraphs. First say what it is, and then give the
motivation.
No problem -- since this is a Wiki, you can perform the swap yourself!
(If you haven't done it in a day or so, I'll do the deed.)
: in the call method, it should inject self.im_self as
first arg, not self.im_func. This had been spotted by someone named John
Posner, IIRC !-)
Fixed (oops!).
I've updated the text at this location:
http://cl1p.net/bruno_0301.rst/
I think the ball is back in your court, Bruno. I'd be happy
On 3/2/2010 10:19 AM, Roy Smith wrote:
Somewhat sadly, in my case, I can't even machine process the header
file. I don't, strictly speaking, have a header file. What I have is
a PDF which documents what's in the header file, and I'm manually re-
typing the data out of that. Sigh.
Here's an
On 3/1/2010 1:07 PM, Raphael Mayoraz wrote:
John Posner wrote:
On 2/26/2010 6:32 PM, Raphael Mayoraz wrote:
Hello,
I'd like to define variables with some specific name that has a common
prefix.
Something like this:
varDic = {'red': 'a', 'green': 'b', 'blue': 'c'}
for key, value
On 3/1/2010 2:59 PM, Bruno Desthuilliers wrote:
Answer here:
http://groups.google.com/group/comp.lang.python/tree/browse_frm/thread/bd71264b6022765c/3a77541bf9d6617d#doc_89d608d0854dada0
I really have to put this in the wiki :-/
Bruno, I performed a light copy-edit of your writeup and put
On 2/26/2010 4:21 PM, qtrimble wrote:
fileIN = open(rC:\testing.txt, r)
for line in fileIN:
year = line[3:7]
day = line[7:10]
print year, day
This is good since i can get the year and day of year into a variable
but I haven't gotten any further.
That's an excellent start.
On 2/26/2010 6:32 PM, Raphael Mayoraz wrote:
Hello,
I'd like to define variables with some specific name that has a common
prefix.
Something like this:
varDic = {'red': 'a', 'green': 'b', 'blue': 'c'}
for key, value in varDic.iteritems():
'myPrefix' + key = value
No trick, just swap a new
On 2/26/2010 10:20 PM, Steven D'Aprano wrote:
On Fri, 26 Feb 2010 20:15:16 -0500, John Posner wrote:
On 2/26/2010 6:32 PM, Raphael Mayoraz wrote:
Hello,
I'd like to define variables with some specific name that has a common
prefix.
Something like this:
varDic = {'red': 'a', 'green': 'b
On 2/24/2010 9:07 AM, Steve Holden wrote:
John Posner wrote:
Note that the Py2.6.4 documentation is inconsistent. AFAICT, it conforms
to Terry's definitions above in most places. But the Glossary says:
generator
A function which returns an iterator more ...
generator expression
generator
An iterator produced by a generator function or a generator
expression.
-John
+1. Can someone submit a documentation patch, please?
Will do. -John
[sorry if this is a dup]
Done: #8012 Revise generator-related Glossary entries
-John
--
On 2/24/2010 12:39 PM, Abigail wrote:
Yesterday I downloaded and installed Python 3.1 and working through some
examples but I have hit a problem
a = raw_input(Enter a number )
Traceback (most recent call last):
File pyshell#6, line 1, inmodule
a = raw_input(Enter a number )
NameError:
On 2/24/2010 4:54 PM, Jonathan Gardner wrote:
On Wed, Feb 24, 2010 at 12:23 PM, Andreas Waldenburger
use...@geekmail.invalid wrote:
Hi all,
a company that works with my company writes a lot of of their code in
Python (lucky jerks). I've seen their code and it basically looks like
this:
1 - 100 of 233 matches
Mail list logo