On 21 April 2010 20:56, candide wrote:
> Is the del instruction able to remove _at the same_ time more than one
> element from a list ?
Yup:
>>> z=[45,12,96,33,66,'c',20,99]
>>> del z[:]
>>> z
[]
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
ElementTree in the standard library is one good choice here
if you're not wedded to one of DOM or SAX.
What have you tried so far? No one is going to write code for you, but
we'd be happy to help you fix problems with your own code.
<http://catb.org/~esr/faqs/smart-questions.html>
On 17 May 2010 10:43:06 UTC+1, Shanti Bhushan wrote:
> Hi simon,
> you are right in 2nd paragaraph.
> i have a piece of XML with some URLs in it that i want to
> extract.
> I have no clue from where to get help on this.
> Please atleast guide me for document or link where i can
On 18 May 2010 06:21:32 UTC+1, Vincent Davis wrote:
>
> Just wondering if there is a problem with mixing a dictionary into a class
> like this. Everything seems to work as I would expect.
No problem at all AFAIC.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
les.
mxODBC might well be what you are looking for,
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
On 21 May 2010 11:21:11 UTC+1, Deep_Feelings wrote:
> 1- where are the programs that is written in python ?
> 2- python is high productivity language : why there are no commercial
> programs written in python ?
See http://www.python.org/about/success/
--
Cheers,
Simon B.
t can't tell you what
they are. ;-)
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
ng your module
something else, and you should be golden.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
On 24 May 2010 14:59:24 UTC+1, dirknbr wrote:
> It doesn't error on 'import email' but does on call to MimeText.
>
> import email
> msg = MIMEText('test')
>
> NameError: name 'MIMEText' is not defined
Here you want:
msg = email.MIMEText(
plementation detail, and shouldn't be relied upon.
This same issue also comes up with people noticing that they can
compare small integers with the 'is' operator, and getting a surprise
when bigger numbers come along:
>>> a = 256
>>> b = 256
>>> a is b
True
>>> a = 257
>>> b = 257
>>> a is b
False
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
On 2 June 2010 09:04:56 UTC+1, pyDev wrote:
> I hope here will be
> someone ready to welcome and help newcomers to enter the beautiful
> world of Python.
Just send them here, or to
<http://mail.python.org/mailman/listinfo/tutor>. We'll be happy to
help.
--
Cheer
d code
base by 2x or more just isn't supportable.
Tkinter is perfectly adequate for basic GUIs. If you want something
more sophisticated there are plently of high quality, well documented
alternatives to match your platform or functionality requirements.
Simon Hibbs
--
http://mail.python.org/mailman/listinfo/python-list
On 9 June 2010 11:44, madhuri vio wrote:
> thankyou so much ..i made it finally...
> how do i make buttons and i want a lil text to label the buttons also
You might want to run through
<http://www.pythonware.com/library/tkinter/introduction/>.
--
Cheers,
Simon B.
--
http://mai
module names be lower case. Python 3 was an opportunity to make
non-backwardly compatible fixes, including to the standard library.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
On 10 June 2010 07:38, madhuri vio wrote:
>
> i was wondering bout the usage and syntax of
> grep command..can u tall me its syntax so that
> i can use it and proceed...pls
That's really not on topic for this list.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
On 10 June 2010 08:19, Shashwat Anand wrote:
> And please stop using 'sir' for heaven's sake.
Not least because list list isn't male only.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
2010/6/11 yanhua :
> hi,all!
> it's a simple question:
> input two integers A and B in a line,output A+B?
print sum(int(i) for i in raw_input("Please enter some integers: ").split())
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
me to the Android environment? I'm not talking
> backend stuff here but full front and center like full GTK or WX
> development for the devices?
Sadly, I gather that Google has no plans for this. But hey, it's open
source, right?
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 23 Jun 2010 10:46:37 -0430, Victor Subervi
wrote:
> On Wed, Jun 23, 2010 at 10:25 AM, Stephen Hansen
> wrote:
>
>> On 6/23/10 6:45 AM, Victor Subervi wrote:
>> > Hi;
>> > I have this line:
>> >
>> > cursor.execute('select clientEmail from clients where client=%s',
>> > (string.replace(c
m=tb,maxi=lines)
Here you are attempting to call a function with the name 'lines'. But
'lines' has been assigned an integer above.
I'm assuming that elsewhere you've defined a function called 'lines'.
You'll need to call either the function or the option by anot
use a
> more pythonic approach.
The Grinder?
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
to know if Python is suitable for helping me:
Monitoring the UNIX box?
Get some metrics from Sybase and Oracle?
Get JMX metrics from Weblogic Server (Weblogic Server is provided with a
scripting tool based on Jython)
Thanks for your hints.
Simon
--
http://mail.python.org/mailman/listinfo/python-list
Le 15/07/2010 14:26, Steven D'Aprano a écrit :
On Thu, 15 Jul 2010 09:36:25 +0200, Simon SSt wrote:
Hi,
Never too late to discover a new language :-)
I hope anybody could help me answering my questions. I'm a technical
consultant for a software editor. Our software is running o
or a csv
> file?
Sure, but mechanize only does the first half of the job. You retrieve
the data using mechanize, then use another module for the save-as bit.
ElementTree for XML and csv for, um, for csv are both in the standard
library.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
e
candidate to come in and pair with one of our devs in adding a simple
feature or two to their own code. It's time consuming, but not so time
consuming as hiring a weak dev.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
tp://www.codecodex.com/wiki/index.php?title=Main_Page
> http://merd.sourceforge.net/pixel/language-study/scripting-language/
> http://pleac.sourceforge.net/
> http://www.angelfire.com/tx4/cus/shapes/index.html
And my favorite: http://99-bottles-of-beer.net/
--
Cheers,
Simon B.
--
http://mai
I suggest you look at matplotlib. It's a bit of a learning curve but will
do whatever you need. I have a similar requirement and found that gnuplot
did not work for me. The plots are impressive.
Paul Simon
wrote in message
news:h1nv4q$5k...@news.dialog.net.pl...
> Hello,
&g
a GUI toolkit for Python?
FWIW, I created a simple GUI builder module I call pygoo that lets you
create Tkinter GUIs from a simple text "specification".
http://www.pygoo.com/
http://code.google.com/p/pygoo/
Warm regards,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
n.co.uk/politics/2009/jun/18/mps-expenses-crowdsourcing-app>
- The Guardian, a UK national newspaper, quickly wrote and deployed a
Python application to allow their readers to cooperate in the massive
manual task of analysing MPs' expenses receipts, looking for
ill-doing.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
On Jun 28, 11:03 am, News123 wrote:
> Hi.
>
> I started playing with PIL.
>
> I'm performing operations on multiple images and would like compromise
> between speed and memory requirement.
>
> The fast approach would load all images upfront and create then multiple
> result files. The problem is,
e warning category (see below), the text of the warning
message, and the source location where it is issued. Repetitions of a
particular warning for the same source location are typically
suppressed." - http://docs.python.org/library/warnings.html
That said, why not just use exceptions?
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Jun 28, 2009 at 1:22 PM, kj wrote:
> In <87fxdlujds@benfinney.id.au> Ben Finney
> writes:
>
>>(Even if you don't want to receive email, could you please give your
>>actual name in the ‘From’ field instead of just initials? It makes
>>conversation less confusing.)
>
> I don't know why,
On Sat, Jun 13, 2009 at 11:49 AM, koranthala wrote:
> Hi all,
> I do understand that this is not a python question and I apologize
> for that straight up.
> But I am a full time follower of this group and I have seen very
> very brilliant programmers and solutions.
> I also want to be a go
On Mon, Jun 29, 2009 at 12:18 PM, Elf Scripter wrote:
> Hello,
> Has anyone created an Instance Messenger in Python before, i mean a simple
> or Complex GUI based instance messenger?
> I thought about something like, the client also act as server, has it`s own
> listening port, but how can i handle
On Mon, Jun 29, 2009 at 12:44 PM, Elf Scripter wrote:
> Thank you for correcting my mistake.
> I checked google but nothing close. did you have any idea?
>
> On Mon, Jun 29, 2009 at 5:42 PM, Simon Forman wrote:
>>
>> On Mon, Jun 29, 2009 at 12:18 PM, Elf Scripter
>&g
subdirectories like
"build", "Demo", "Doc", "Include", "Lib", etc. There are many files under
/usr/bin/local/ which appear to be duplicates.
This looks like a mess to me and would like some help to sort this out.
Paul Simon
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 1, 7:18 pm, Alex wrote:
> I am looking for an open source RSS reader (desktop, not online)
> written in Python but in vain. I am not looking for a package but a
> fully functional software.
>
> Google: python "open source" (rss OR feeds) reader
>
> Any clue ?
There's Canto: http://codezen.
ttp://catb.org/esr/faqs/smart-questions.html>. Our *four*...no...
*Amongst* our links Amongst our linkry are such elements as
<http://effbot.org/zone/unicode-objects.htm>,
<http://www.joelonsoftware.com/articles/Unicode.html> I'll come in
again.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
Hey I was hoping to get your opinions on a sort of minor stylistic
point.
These two snippets of code are functionally identical. Which would you
use and why?
The first one is easier [for me anyway] to read and understand, but
slightly less efficient, while the second is [marginally] harder to
follo
On Jul 2, 1:44 pm, Duncan Booth wrote:
> Simon Forman wrote:
> > Hey I was hoping to get your opinions on a sort of minor stylistic
> > point.
> > These two snippets of code are functionally identical. Which would you
> > use and why?
> > The first one is e
On Jul 2, 4:08 pm, Erik Max Francis wrote:
> Simon Forman wrote:
> > Hey I was hoping to get your opinions on a sort of minor stylistic
> > point.
> > These two snippets of code are functionally identical. Which would you
> > use and why?
> > The first one is e
On Jul 2, 3:57 pm, Scott David Daniels wrote:
> Duncan Booth wrote:
> > Simon Forman wrote:
> >> ...
> >> if self.higher is self.lower is None: return
> >> ...
> > As a matter of style however I wouldn't use the shorthand to run two 'is'
&
On Wed, Jul 1, 2009 at 7:48 AM, Barak, Ron wrote:
> Hi,
>
> I think I'm up against a limitation in cStringIO.StringIO(), but could not
> find any clues on the web, especially not in
> http://docs.python.org/library/stringio.html.
>
> What I have is the following function:
>
> def concatenate_fi
On Jul 2, 9:30 pm, Paul Rubin <http://phr...@nospam.invalid> wrote:
> Simon Forman writes:
> > This code is part of a delete() method for a binary tree
> > implementation. "None" is used to simulate a NULL pointer. In the case
> > where both children are non
t; Thanks!
Okay people want to help you but you must make it easy for us.
Post again with a small piece of code that is runnable as-is and that
causes the traceback you're talking about, AND post the complete
traceback too, as-is.
I just tried a bit of your code above in my interpreter here
appreciated.
>
> Johnson
I don't know much about caching with apache, but the answer mght be on
this page: http://httpd.apache.org/docs/2.2/caching.html
Meanwhile, couldn't you just send apache a restart signal when you
modify your code?
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 3, 2:09 am, Lie Ryan wrote:
> Simon Forman wrote:
> > On Jul 2, 3:57 pm, Scott David Daniels wrote:
> >> Duncan Booth wrote:
> >>> Simon Forman wrote:
> >>>> ...
> >>>> if self.higher is self.lower is None: return
> >>&
On Jul 3, 12:56 am, Paul Rubin <http://phr...@nospam.invalid> wrote:
> Simon Forman writes:
> > > Yes, but the concept of null pointers is considered kludgy these days.
> > Seriously? "kludgy"? (I really AM getting old.)
>
> http://math.andrej.com/2
On Jul 3, 8:15 am, srinivasan srinivas
wrote:
> Hi,
> Could you suggest some python debuggers?
>
> Thanks,
> Srini
>
> Love Cricket? Check out live scores, photos, video highlights and more.
> Click herehttp://cricket.yahoo.com
Ipython has good debugger integration.
--
http://mail.python.
On Jul 4, 2:03 am, upwestdon wrote:
> On Jul 2, 1:23 pm, Simon Forman wrote:
>
>
>
> > Hey I was hoping to get your opinions on a sort of minor stylistic
> > point.
> > These two snippets of code are functionally identical. Which would you
> > use and why?
On Jul 4, 2:10 pm, Paul Rubin <http://phr...@nospam.invalid> wrote:
> Simon Forman writes:
> > > if not (self.higher and self.lower):
> > > return self.higher or self.lower
>
> > That would work too in this case, both higher and lower are expected
>
which is why you can (or should be able
to without breaking your code) remove them entirely and know that your
program will run identically. That's why folks are quick to jump on
cases where assertions are used as control-flow constructs. (In your
function, however, they aren't.)
In a sense, assertions /are/ meaningless, except to the programmer.
FWIW, you can use "if __debug__:" and put anything you like in the
statement suite and the whole if statement goes away when run with '-
O'. Sort of a "super-assert".
Regards,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 5, 9:48 pm, "W. eWatson" wrote:
> The code below produces a text window 60hx20w with a scroll bar. The
> contents are something of a histogram of values from 0 to 255. If one tries
> to copy the contents, Windows doesn't allow it. What needs to be done to
> allow a copy and paste?
>
>
need to write a python
> script which invokes my program and pass "Enter key" event to my
> program so that it runs without manual intervention.
Try <http://pywinauto.openqa.org/>.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Jul 6, 2009 at 6:12 AM, mayank gupta wrote:
> Thanks for the other possibilites. I would consider option (2) and (3) to
> improve my code.
>
> But out of curiosity, I would still like to know why does an object of a
> Python-class consume "so" much of memory (1.4 kb), and this memory usage
dielectric constant" seems to be a dimensionless number, i.e. C/C...
I could be totally daft though.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 6, 6:02 pm, Michael Mossey wrote:
> On Jul 6, 2:47 pm, Philip Semanchuk wrote:
>
> > On Jul 6, 2009, at 5:37 PM, Michael Mossey wrote:
>
> > > What is required in a python program to make sure it catches a
> > > control-
> > > c on the command-line? Do some i/o? The OS here is Linux.
>
>
On Tue, Jul 7, 2009 at 8:51 AM, Jean-Michel
Pichavant wrote:
> Steven D'Aprano wrote:
>>
>> On Tue, 07 Jul 2009 05:13:28 +, Lie Ryan wrote:
>>
>>
>>>
>>> When people are fighting over things like `sense`, although sense may
>>> not be strictly wrong dictionary-wise, it smells of something burni
gs)
function_outputs = cpus.map(f, function_inputs)
(Note that f() could be defined outside the if statement if you're
going to use it often.)
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 7, 4:04 pm, kj wrote:
> I'm having a hard time coming up with a reasonable way to explain
> certain things to programming novices.
>
> Consider the following interaction sequence:
>
> >>> def eggs(some_int, some_list, some_tuple):
>
> ... some_int += 2
> ... some_list += [2]
> ...
On Jul 8, 10:44 am, Daniel Austria wrote:
> Hi python - hackers,
>
> just one question. How can i remove all 0 values in a list? Sure - i
> can loop over it, but that s not a neat style. list.remove() will
> only remove the first occurence. Doing that while no exception is
> raised is also uncool
only to the
point of confusion. I'm not an expert. How do I modify my python
configuration? Is there a file that needs to be edited? Which setup.py file
do I use? Make? or python setup.py build and python setup.py install?
Thanks. I appreciate your help.
Paul Simon
--
http://mail.python.org/mailman/listinfo/python-list
"Chris Rebert" wrote in message
news:mailman.2863.1247095339.8015.python-l...@python.org...
On Wed, Jul 8, 2009 at 4:18 PM, Paul Simon wrote:
> I have the "tkinter" problem and need some assistance to straighten it
> out.
> >From the web page "http://wiki.
(I wanted to reply to a few messages in one post so I quoted them all
below. Let me know if this is bad etiquette.)
On Jul 8, 8:23 am, kj wrote:
> In <5f0a2722-45eb-468c-b6b2-b7bb80ae5...@q11g2000yqi.googlegroups.com> Simon
> Forman writes:
>
> >Frankly, I'm of
"Peter Otten" <__pete...@web.de> wrote in message
news:h3481q$d95$0...@news.t-online.com...
> Paul Simon wrote:
>
>> "Chris Rebert" wrote in message
>> news:mailman.2863.1247095339.8015.python-l...@python.org...
>> On Wed, Jul 8, 2009 at
Python applications, or export them to standard assembly
languages."
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ed in the last few years)
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
"David Smith" wrote in message
news:h35f78$pt...@ruby.cit.cornell.edu...
> Paul Simon wrote:
>> "Peter Otten" <__pete...@web.de> wrote in message
>> news:h3481q$d95$0...@news.t-online.com...
>>> Paul Simon wrote:
>>>
>>>>
On Jul 14, 1:10 pm, Duncan Booth wrote:
> John Machin wrote:
> > Try an iterative version of checking that () [] and {}
> > are balanced and nested appropriately.
>
> Here's how I might approach the more general case:
>
> def balanced(s, parens=("()",)):
> '''
> Example:
> >>> balance
.
But I'm glad it's there to study, these are wheels I don't have to
invent for myself.
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ing programs logically. Making the formal methods explicit gives
you the strongest available confidence that you are reasoning, and
programming, correctly.
This is not to say that "incorrect" (or unproven or unprovable)
programs are never useful or necessary. However, I do feel that it's
27;method', 1, 2, foo=3)", number=1000)
> timeit.timeit(setup="from __main__ import apply1,apply2,L",
> stmt="apply2(L,'method', 1, 2, foo=3)", number=1000)
>
>
> --
> Gabriel Genellina
If your instances are all of the same class
On Mon, Jul 20, 2009 at 9:54 PM, Paul Rubin<http://phr...@nospam.invalid> wrote:
> Simon Forman writes:
>> But I'm glad it's there to study, these are wheels I don't have to
>> invent for myself.
>
> http://dwheeler.com/essays/high-assurance-floss.html
and the types of
the fields are implied by use, not explicitly declared.)
(FWIW: http://en.wikipedia.org/wiki/Record_(computer_science) )
Broadly speaking, lists are useful for things like stacks and queues,
and sorting, while tuples are useful for aggregating heterogeneous
data into coherent units, and you can hash them (provided their
contents are also hashable.)
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 21, 5:00 pm, davidj411 wrote:
> I am using a recursive function to print the time and a few other
> things on each pass. ( the function calculates size of file that is
> being transferred and if not 100 % copied, it waits 20 secs and checks
> again).
>
> i would expect the time to be correc
On Jul 21, 5:53 pm, davidj411 wrote:
> On Jul 21, 5:29 pm, Simon Forman wrote:
>
>
>
> > On Jul 21, 5:00 pm, davidj411 wrote:
>
> > > I am using a recursive function to print the time and a few other
> > > things on each pass. ( the function calc
module with Python and I am
> thinking of doing this in as my final year project also. Kindly give
> me your suggestion.
What would this give us that ReportLab does not? I wouldn't want to
see you spend a lot of time reinventing the wheel...
--
Cheers,
Simon B.
--
http://mail.python.org/
On Wed, Jul 29, 2009 at 3:10 PM, Omer Khalid wrote:
> Hi Dave,
>
> Thanks for your reply. I actually didn't cut and paste my code as it was
> dispersed in different places, i typed the logic behind my code in the email
> (and obiviously made some typos, indentations is some thing else) but my
Plea
On Aug 7, 4:53 pm, kj wrote:
> Suppose that x is some list. To produce a version of the list with
> duplicate elements removed one could, I suppose, do this:
>
> x = list(set(x))
>
> but I expect that this will not preserve the original order of
> elements.
>
> I suppose that I could write so
be too difficult, but I don't know how. > <
> Help appreciated!
There's a bug in this line:
if line.find('1'):
the string find() method returns an integer, which will be -1 if the
substring is not found. In python -1 is treated as True (only 0 is
False) so your if stat
On Aug 11, 11:51 am, MRAB wrote:
> Krishna Pacifici wrote:
> > Thanks for the help.
>
> > Actually this is part of a much larger project, but I have unfortunately
> > pigeon-holed myself into needing to do these things without a whole lot
> > of flexibility.
>
> > To give a specific example I have
;http://tinyurl.com/c5nqju> and many more), I'm sorry to say that I
don't think this is funny.
--
Cheers,
Simon B.
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 12, 10:41 am, Robert Dailey wrote:
> On Aug 12, 9:09 am, exar...@twistedmatrix.com wrote:
>
>
>
> > On 01:27 pm, jeanmic...@sequans.com wrote:
>
> > >Simon Brunning wrote:
> > >>2009/8/11 Robert Dailey :
> > >>>On Aug 11, 3:
gt; table1 ]
>
> so is there a way to force itemgetter to return tuple even when
> itemgetter(only_have_one_argument)? or some other function to do this?
>
> Thanks.
>
You can use a little helper function to create your itemgetter like this:
def makeItemGetter(indexes):
I = ite
On Aug 14, 8:22 pm, candide wrote:
> Suppose you need to split a string into substrings of a given size (except
> possibly the last substring). I make the hypothesis the first slice is at the
> end of the string.
> A typical example is provided by formatting a decimal string with thousands
> separ
On Mon, Aug 17, 2009 at 3:51 PM, David Brochu wrote:
> I need to compare one xml document to another to see if the content matches.
> Unfortunately, the formatting (spacing) and order of elements may change
> between files from run to run. I have looked into xml dom minidom but can't
> seem to find
On Tue, Aug 18, 2009 at 1:57 AM, Steven
D'Aprano wrote:
> On Mon, 17 Aug 2009 21:45:57 -0700, naveen wrote:
>
>> Is it possible to split up a class definition over multiple files?
>
> Not exactly, but you can do variations of this:
>
>
> In file A.py, create:
>
> class Parent:
> def method(self)
On Tue, Aug 18, 2009 at 1:05 PM, Jean-Michel
Pichavant wrote:
> Steve Holden wrote:
Robert Dailey:
>>
>> [...]
>>
>>>
>>> It's a figure of speech. And besides, why would I want programming
>>> advice from a woman? lol. Thanks for the help.
>>>
>>
>> Sorry, Robert, simply not acceptab
rt partial
def getter(first, second, key):
try:
return first(key)
except KeyError:
return second(key)
f = partial(getter, b.__getitem__, a.__getitem__)
# Or, if you know you'll be getting a lot of KeyErrors, you
# can use get() instead of __getitem__().
def getter1(first, second, key, sentinel=None):
item = first(key, sentinel)
if item is sentinel:
item = second(key)
return item
g = partial(getter1, b.get, a.__getitem__)
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Aug 18, 2009 at 6:08 PM, Simon Forman wrote:
> On Aug 18, 3:44 pm, Pavel Panchekha wrote:
>> I want a dictionary that will transparently "inherit" from a parent
>> dictionary. So, for example:
>>
>> """
>> a = InheritDict({1: &quo
On Tue, Aug 18, 2009 at 8:03 PM, Steven
D'Aprano wrote:
> On Tue, 18 Aug 2009 17:13:02 -0400, Simon Forman wrote:
>
>> Sexism, racism, homophobia, religious intolerance, etc., all stem from a
>> fundamental forgetfulness of our Unity in God (as I would put it) and
>
>
On Tue, Aug 18, 2009 at 8:42 PM, Ben Finney wrote:
> Simon Forman writes:
>
>> Sexism, racism, homophobia, religious intolerance, etc., all stem from
>> a fundamental forgetfulness of our Unity in God (as I would put it)
>
> It seems odd, for someone who cites religious
On Aug 18, 7:33 pm, Allan wrote:
> Hi! I'm fairly new to Python. I understand the basics basics but I'm
> been trying to write a simple python code that will let me read input
> data (such as mouse movement) from my USB port and write it in a text
> file and I am so lost. Can anyone help or dire
On Aug 19, 12:05 am, Ben Finney wrote:
> Simon Forman writes:
> > On Tue, Aug 18, 2009 at 8:42 PM, Ben Finney
> > wrote:
> > > We're all unified by our humanity. Bringing any god into the picture
> > > is surely counter to any goals of unity.
>
> >
(a, b):
a = set(a)
d = defaultdict(int)
for item in b:
if item in a:
d[item] += 1
return d
print g(A, B)
# prints defaultdict(, {' ': 1, 'e': 1, 'g': 1, 'i': 1,
'o': 1, 'n': 2, 's': 1, 'r': 2, 't': 2})
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 19, 11:34 pm, John Machin wrote:
> On Aug 20, 12:12 pm, Simon Forman wrote:
>
> > On Aug 19, 8:17 pm, "Jan Kaliszewski" wrote:
> > > If you mean: to count non overlaping occurences of string A in B
> > > -- simply:
>
> > > B.count(A
On Aug 20, 3:06 pm, David <71da...@libero.it> wrote:
> Hi all,
>
> Is there some magic to make the 2.x CPython interpreter to ignore the
> annoying octal notation?
No. You would have to modify and recompile the interpreter. This is
not exactly trivial, see "How to Change Python's Grammar"
http://
the optional base. It is an error to supply a base when
converting a
| non-string. If the argument is outside the integer range a long
object
| will be returned instead.
|
| Methods defined here:
|
...
Unfortunately you can't use it on the '%' string formatting
operator...
>>> help(%)
SyntaxError: invalid syntax
So here's a link to the docs:
http://docs.python.org/library/stdtypes.html#string-formatting-operations
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 20, 5:18 pm, "Rami Chowdhury" wrote:
> > val = val.encode('hex')
>
> That's the crucial line -- it's returning a new integer, which you are
> re-binding to val. If you then did:
No, it returns another string, which still isn't the decimal
representation of the hex string. hex C => decim
#x27;x': 1}
I don't understand what you're trying to do, but give up the idea of
"object reference memory locations". Any name binding in python just
associates a string with a object in one of various namespace
dictionaries.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
1401 - 1500 of 1585 matches
Mail list logo