On Dec 27, 6:01 pm, Tim Harig wrote:
> On 2010-12-27, flebber wrote:
>
> > Is there anyay to use input masks in python? Similar to the function
> > found in access where a users input is limited to a type, length and
> > format.
>
> > So in my case I want to ensure that numbers are saved in a bas
On 2010-12-27, Tim Harig wrote:
> ... if re.match(r'''^[0-9]{2}:[0-9]{2}:[0-9]{2}$''', timeInput) == None:
[SNIP]
> Currency works the same way using validating it against:
> r'''[0-9]+\.[0-9]{2}'''
Sorry, you need to check to make sure that there are no trailing characters
as in the example abov
Steven D'Aprano wrote:
...
>
I think critics of my position have forgotten what it's like to learning
the language. One of the most valuable skills to learn is to *ignore
parts of the traceback* -- a skill that takes practice and familiarity
with the library or function in use. To those who a
On 2010-12-27, flebber wrote:
> Is there anyay to use input masks in python? Similar to the function
> found in access where a users input is limited to a type, length and
> format.
>
> So in my case I want to ensure that numbers are saved in a basic
> format.
> 1) Currency so input limited to 000
"gintare" wrote in message
news:83dc3076-9ddc-42bd-8c33-6af96b263...@l32g2000yqc.googlegroups.com...
Hello,
STILL do not work. WHAT to be done.
import codecs
item=u'hyv\xe4'
F=codecs.open('/opt/finnish.txt', 'w+', 'utf8')
F.writelines(item.encode('utf8'))
F.close()
In file i find 'hyv\xe4' i
Hello,
STILL do not work. WHAT to be done.
import codecs
item=u'hyv\xe4'
F=codecs.open('/opt/finnish.txt', 'w+', 'utf8')
F.writelines(item.encode('utf8'))
F.close()
In file i find 'hyv\xe4' instead of hyvä.
(Sorry for mistyping in previous letter about 'latin-1'. I was making
all possible combin
On Sun, 26 Dec 2010 17:12:50 -0800, misno...@gmail.com wrote:
> On Dec 23, 3:22 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote:
>> You seem to have completely missed that there will be no bug report,
>> because this isn't a bug. (Or if it is a bug, the bug is elsewhere,
>> external to
On Sun, 26 Dec 2010 09:15:32 -0800, Ethan Furman wrote:
> Steven D'Aprano wrote:
>> Right. But I have thought of a clever trick to get the result KJ was
>> asking for, with the minimum of boilerplate code. Instead of this:
>>
>>
>> def _pre_spam(args):
>> if condition(args):
>> raise
On Sun, 26 Dec 2010 18:49:55 +, kj wrote:
> In Ian Kelly
> writes:
>
>>On 12/26/2010 10:53 AM, kj wrote:
>>> P.S. If you uncomment the commented-out line, and comment out the last
>>> line of the __init__ method (which installs self._delitem as
>>> self.__delitem__) then *all* the deletion
Is there anyay to use input masks in python? Similar to the function
found in access where a users input is limited to a type, length and
format.
So in my case I want to ensure that numbers are saved in a basic
format.
1) Currency so input limited to 000.00 eg 1.00, 2.50, 13.80 etc
For sports tim
On Sun, Dec 26, 2010 at 4:33 PM, Python Programming wrote:
> Hello all,
>
> Newbie here so go easy on me. I've been trying to get the IDLE GUI to
> work on my machine, but have been unsuccessful so far. I have an IBM
> Thinkpad running Windows XP and it has an older version of Python
> running (
On Dec 25, 2:49 pm, Steven D'Aprano wrote:
> On Sat, 25 Dec 2010 09:17:27 -0500, Robert Kern wrote:
> > On 12/24/10 5:14 PM, Ethan Furman wrote:
>
> >> There are also times when I change the exception being raised to match
> >> what python expects from that type of object -- for example, from
> >>
On Dec 26, 11:09 am, kj wrote:
> In writes:
>
> >Except that the *caller* never gets the traceback (unless if it deliberately
> >inspects the stack for some metaprogramming reason). It gets the exception,
> >and
> >that is the same no matter what you do. The developer/user gets the
> >tracebac
On Dec 23, 3:22 am, Steven D'Aprano wrote:
> You seem to have completely missed that there will be no bug report,
> because this isn't a bug. (Or if it is a bug, the bug is elsewhere,
> external to the function that raises the exception.) It is part of the
> promised API. The fact that the excepti
On 12/26/2010 2:14 PM, kj wrote:
> In Ethan Furman
> writes:
>
>> You failed to mention that cleverness is not a prime requisite of the
>> python programmer -- in fact, it's usually frowned upon.
>
> That's the party line, anyway. I no longer believe it. I've been
> crashing against one bit
Hello all,
Newbie here so go easy on me. I've been trying to get the IDLE GUI to
work on my machine, but have been unsuccessful so far. I have an IBM
Thinkpad running Windows XP and it has an older version of Python
running (2.2, I believe). When I try to use the shortcut to open the
IDLE GUI n
On 26/12/2010 22:43, gintare wrote:
Could you please help me with special characters saving to file.
I need to write the string u'hyv\xe4' to file.
I would like to open file and to have line 'hyvä'
import codecs
word= u'hyv\xe4'
F=codecs.open(/opt/finnish.txt, 'w+','Latin-1')
This opens the f
Hello everyone. I'm writing a script in Python 2.7 which uses a
urllib2.OpenerDirector instance via urllib2.build_opener() to take
advantage of the urllib2.HTTPCookieProcessor class, because I need to
store and re-send the cookies I get:
opener =
urllib2.build_opener(urllib2.HTTPCookieProcessor(co
On 26 Dic, 19:24, Ciccio wrote:
> Try this:
> 1) define a function 'foo' in a script
> 2) runfile the script from a shell
> 3) do 'inspect.getsource(foo)'
> 4) change the source of 'foo'
> 5) runfile the script from the same shell
> 6) do 3 again
>
> On my 2.6.6 getsource returns twice the same co
Could you please help me with special characters saving to file.
I need to write the string u'hyv\xe4' to file.
I would like to open file and to have line 'hyvä'
import codecs
word= u'hyv\xe4'
F=codecs.open(/opt/finnish.txt, 'w+','Latin-1')
F.writelines(item.encode('Latin-1'))
F.writelines(item.
Jim, 26.12.2010 00:32:
On Dec 25, 5:33 am, Stefan Behnel wrote:
lxml knows about this special case, so you can write
{http://www.w3.org/XML/1998/namespace}lang
and lxml will take care of using the right prefix.
Stefan, thank you for the software, which has helped me a great deal.
I
Am 26.12.2010 19:49, schrieb kj:
> How do you know this? Is this documented? Or is this a case of
> Monday-night quarterbacking?
Please stop bitching around. You know that by carefully reading the
documentation:
http://docs.python.org/reference/datamodel.html#special-method-lookup-for-new-style-
On 2010-12-26, Stefan Behnel wrote:
> Tim Harig, 26.12.2010 10:22:
>> On 2010-12-26, Stefan Behnel wrote:
>>> Tim Harig, 26.12.2010 02:05:
On 2010-12-25, Nobody wrote:
> On Sat, 25 Dec 2010 14:41:29 -0500, Roy Smith wrote:
>> Of course, one advantage of XML is that with so much redund
@Katie
Thank you I considered this option until I realized it wouldn't let me
do anything other than ping from the command line.
The rest of you all make valid points after doing a little more
research on my own I found some really nice web based text editors but
they didn't have any testing abili
A Brief Illustrated Guide To Understanding Islam Home
http://www.islam-guide.com/
--
http://mail.python.org/mailman/listinfo/python-list
On 12/25/2010 2:50 PM, Steven D'Aprano wrote:
On Fri, 24 Dec 2010 10:51:32 -0800, John Nagle wrote:
On 12/24/2010 3:24 AM, Carl Banks wrote:
On Dec 24, 1:24 am, Steven D'Aprano wrote:
All I'm
suggesting is that there should be a way of reducing the boilerplate
needed for this idiom:
de
In Ethan Furman
writes:
>You failed to mention that cleverness is not a prime requisite of the
>python programmer -- in fact, it's usually frowned upon.
That's the party line, anyway. I no longer believe it. I've been
crashing against one bit of cleverness after another in Python's
unificat
In writes:
>Except that the *caller* never gets the traceback (unless if it deliberately
>inspects the stack for some metaprogramming reason). It gets the exception,
>and
>that is the same no matter what you do. The developer/user gets the traceback,
>and those implementation details *are* of
Am 25.12.2010 16:42, schrieb Roy Smith:
I'm processing a stream of N numbers and want to keep track of the K
largest. There's too many numbers in the stream (i.e. N is too large)
to keep in memory at once. K is small (100 would be typical).
> From a theoretical point of view, I should be able
In Ian Kelly
writes:
>On 12/26/2010 10:53 AM, kj wrote:
>> P.S. If you uncomment the commented-out line, and comment out the
>> last line of the __init__ method (which installs self._delitem as
>> self.__delitem__) then *all* the deletion attempts invoke the
>> __delitem__ method, and are there
In Duncan Booth
writes:
>kj wrote:
>> Watch this:
>>
> class neodict(dict): pass
>> ...
> d = neodict()
> type(d)
>>
> type(d.copy())
>>
>>
>>
>> Bug? Feature? Genius beyond the grasp of schlubs like me?
>Feature.
>In (almost?) all cases any objects constructed by a s
"John O'Hagan" writes:
>IMO one of the benefits of subclassing is that you can just "bolt on"
>additional behaviour without having to know all the inner workings of the
>superclass, a benefit that is somewhat defeated by this behaviour of builtins.
I agree. I've read the old post/articles b
Am 26.12.2010 18:53, schrieb kj:
> It means that, for both subclasses, del fails to trigger the
> dynamically installed instance method __delitem__.
Magic methods like __delitem__ are looked up on the type, not on the
instance. You can't change the behaviour on instances.
> If I replace dict with
Try this:
1) define a function 'foo' in a script
2) runfile the script from a shell
3) do 'inspect.getsource(foo)'
4) change the source of 'foo'
5) runfile the script from the same shell
6) do 3 again
On my 2.6.6 getsource returns twice the same code. I couldn't find
very much about this, is there
On 12/26/2010 10:53 AM, kj wrote:
P.S. If you uncomment the commented-out line, and comment out the
last line of the __init__ method (which installs self._delitem as
self.__delitem__) then *all* the deletion attempts invoke the
__delitem__ method, and are therefore blocked. FWIW.
Because subcl
When I execute this file:
#--
def nodelfactory(klass):
class nodel(klass):
def _delitem(self, _):
raise TypeError("can't delete")
# __delitem__ = _delitem
def __init__(self, *a, **k):
Steven D'Aprano wrote:
Right. But I have thought of a clever trick to get the result KJ was
asking for, with the minimum of boilerplate code. Instead of this:
def _pre_spam(args):
if condition(args):
raise SomeException("message")
if another_condition(args):
raise Anoth
Steven D'Aprano wrote:
On Sat, 25 Dec 2010 09:17:27 -0500, Robert Kern wrote:
On 12/24/10 5:14 PM, Ethan Furman wrote:
There are also times when I change the exception being raised to match
what python expects from that type of object -- for example, from
WhatEverException to KeyError for a d
Carl Banks wrote:
Python is not, and never has been, about hiding internal details.
It's about openness, and there's no reason a traceback should hide
internal details any more than a class should--in fact hiding
information in the traceback is far worse, because you're suppressing
information th
In article
,
n00m wrote:
> from bisect import insort_left
>
> K = 5
> top = []
> while 1:
> x = input()
> if len(top) < K:
> insort_left(top, x)
> elif x > top[0]:
> del top[0]
> insort_left(top, x)
> print top
>
>
> will be enough
Hmmm, that's an int
On Dec 26, 5:34 am, Alice Bevan–McGregor wrote:
>
> I've never really attempted to use JIT optimizers due to the fact that
> all of my development and production environments are 64-bit, and I
> haven't found one yet that supports 64-bit properly. Relying on dead
> projects, however, is an issue
from bisect import insort_left
K = 5
top = []
while 1:
x = input()
if len(top) < K:
insort_left(top, x)
elif x > top[0]:
del top[0]
insort_left(top, x)
print top
will be enough
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith wrote:
> In article ,
> Duncan Booth wrote:
>
>> Roy Smith wrote:
>>
>> >
>> > I'm processing a stream of N numbers and want to keep track of the K
>> > largest. There's too many numbers in the stream (i.e. N is too large)
>> > to keep in memory at once. K is small (100 would be
On Friday 24 December 2010, 03:58:15 Randy Given wrote:
> Lots of stuff for 2.6 and 2.7 -- what GUI tools are there for 3.1?
PyQt4 of course.
http://www.riverbankcomputing.com
Pete
--
http://mail.python.org/mailman/listinfo/python-list
Tim Harig, 26.12.2010 10:22:
On 2010-12-26, Stefan Behnel wrote:
Tim Harig, 26.12.2010 02:05:
On 2010-12-25, Nobody wrote:
On Sat, 25 Dec 2010 14:41:29 -0500, Roy Smith wrote:
Of course, one advantage of XML is that with so much redundant text, it
compresses well. We typically see gzip compr
So do the new changes(to the GIL) nullify concerns raised by David
Beazely here http://dabeaz.com/python/UnderstandingGIL.pdf
Ah, good catch. I had watched the recorded presentation some time ago.
Yes, the rewritten GIL should alleviate those problems. Instead of
simply releasing and re-acqu
On 2010-12-26, Stefan Behnel wrote:
> Tim Harig, 26.12.2010 02:05:
>> On 2010-12-25, Nobody wrote:
>>> On Sat, 25 Dec 2010 14:41:29 -0500, Roy Smith wrote:
Of course, one advantage of XML is that with so much redundant text, it
compresses well. We typically see gzip compression ratios
On 2010-12-26, Nobody wrote:
> On Sun, 26 Dec 2010 01:05:53 +, Tim Harig wrote:
>
>>> XML is typically processed sequentially, so you don't need to create a
>>> decompressed copy of the file before you start processing it.
>>
>> Sometimes XML is processed sequentially. When the markup footpr
Tim Harig, 26.12.2010 02:05:
On 2010-12-25, Nobody wrote:
On Sat, 25 Dec 2010 14:41:29 -0500, Roy Smith wrote:
Of course, one advantage of XML is that with so much redundant text, it
compresses well. We typically see gzip compression ratios of 20:1.
But, that just means you can archive them e
On Dec 24, 10:17 am, Adam Tauno Williams
wrote:
> On Fri, 2010-12-24 at 20:48 +0530, Nitin Pawar wrote:
> > On Fri, Dec 24, 2010 at 8:40 PM, Jim wrote:
> > Hello, I wonder if someone knows about lxml.etree and
> > namespaces?
>
> Yes, and don't.
He's using lxml.etree (which is a
On Dec 25, 6:21 am, Robert Kern wrote:
> On 12/24/10 4:24 AM, Steven D'Aprano wrote:
>
> > On Thu, 23 Dec 2010 22:38:05 -0800, Carl Banks wrote:
> >> OTOH, going the extra mile to hide useful information from a user is
> >> asinine. As a user, I will decide for myself how I want to use
> >> implem
On Dec 25, 2:49 pm, Steven D'Aprano wrote:
> But that's a separate issue from what is being discussed here. What we're
> discussing here is the idea that a function should be able to delegate
> work to private subroutines without the caller being aware of that fact.
I can't fathom any possible re
52 matches
Mail list logo