On Sat, 09 Oct 2010 22:30:43 -0700, John Nagle wrote:
> Here's an obscure bit of Python semantics which is close to being a bug:
"Obscure"? It's possibly the most fundamental aspect of Python's object
model. Setting instance.attr assigns to the instance attribute, creating
it if it doesn't exis
>>> True == 1
True
>>> False == 0
True
>>> int(True)
1
>>> int(False)
0
>>> bool(1)
True
>>> bool(0)
False
But:
str(fill==True)+','
is simpler than:
("False,", "True,")[fill==True]
--
http://mail.python.org/mailman/listinfo/python-list
Excuse me!!
Would you stop for a moment?!
Haven't you thought-one day- about yourself ?
Who has made it?
Have you seen a design which hasn't a designer ?!
Have you seen a wonderful,delicate work without a worker ?!
It's you and the whole universe!..
Who has made them all ?!!
You know who ?.. It's "
Here's an obscure bit of Python semantics which
is close to being a bug:
>>> class t(object) :
... classvar = 1
...
... def fn1(self) :
... print("fn1: classvar = %d" % (self.classvar,))
... self.classvar = 2
... print("fn1: classvar = %d" % (self.classvar,))
..
chad writes:
> Maybe I'm being a bit dense, but how something like
>
> [cdal...@localhost oakland]$ python
> Python 2.6.2 (r262:71600, May 3 2009, 17:04:44)
> [GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> spam
> T
In message , Ethan
Furman wrote:
> Lawrence D'Oliveiro wrote:
>
>> But they can only recognize it as a BOM if they assume UTF-8 encoding to
>> begin with. Otherwise it could be interpreted as some other coding.
>
> Not so. The first three bytes are the flag.
But this is just a text file. All p
In message
,
tinauser wrote:
> now,the file will be opened only if i give the full path, not if i
> give only the name of the file, although the folder is in the path.
> what am I missing?
The fact that sys.path is not used for that.
--
http://mail.python.org/mailman/listinfo/python-list
In message , Diez B. Roggisch wrote:
> for n in xrange(max_number_of_retries):
> try:
> f=urllib.urlopen(self.url)
> data = f.read()
> break # exist the loop if all
> except IOError:
> pass
Is it worth delaying before retrying? In case of a transient routin
In message , Dennis
Lee Bieber wrote:
> On Windows, the I/O system for text files converts into a
> on input, and on output converts to .
Is it Windows doing that, or is it some Visual Studio library?
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 9, 3:54 pm, flebber wrote:
> I was hoping someone knew how to setup pyscripter or Spe ide's with
> light on dark windows. I start to have trouble reading the nomal dark
> on light screens after any lengthy period.
>
> I have seen several screenshot showing emacs with python setup with
> awe
Finally i had problems to save the files what are encoded i can't encode
the string to save the file, any ideas?
On Oct 6, 2010 3:15pm, hid...@gmail.com wrote:
Ppl thanyou, for all your help finally i did it! thanks, another
thing to who i can send a propose code, i fixed the little probl
We are using Python 2.7 for Windows (32-bit) for a bunch of small
scripts that use simple Tkinter interfaces to prompt for user
input and display information. We're thinking of freezing these
scripts (py2exe or pyinstaller), and we would like to remove some
of the optional/unnecessary files from th
I had a similar problem but i can 't encode a byte to a file what has been
uploaded, without damage the data if i used utf-8 to encode the file
duplicates the size, and i try to change the codec to raw_unicode_escape
and this barely give me the correct size but still damage the file, i used
On Oct 9, 5:52 pm, Steven D'Aprano wrote:
> On Sat, 09 Oct 2010 12:44:29 -0700, chad wrote:
> > Given the following...
>
> > [cdal...@localhost oakland]$ python
> > Python 2.6.2 (r262:71600, May 3 2009, 17:04:44) [GCC 4.1.1 20061011
> > (Red Hat 4.1.1-30)] on linux2 Type "help", "copyright", "cre
On Sat, Oct 9, 2010 at 4:59 PM, Brian Blais wrote:
> This may be a stemming from my complete ignorance of unicode, but when I do
> this (Python 2.6):
>
> s='\xc2\xa9 2008 \r\n'
>
> and I want the ascii version of it, ignoring any non-ascii chars, I thought I
> could do:
>
> s.encode('ascii','ign
On Sat, Oct 9, 2010 at 7:59 PM, Brian Blais wrote:
> This may be a stemming from my complete ignorance of unicode, but when I do
> this (Python 2.6):
>
> s='\xc2\xa9 2008 \r\n'
>
> and I want the ascii version of it, ignoring any non-ascii chars, I thought I
> could do:
>
> s.encode('ascii','ign
This may be a stemming from my complete ignorance of unicode, but when I do
this (Python 2.6):
s='\xc2\xa9 2008 \r\n'
and I want the ascii version of it, ignoring any non-ascii chars, I thought I
could do:
s.encode('ascii','ignore')
but it gives the error:
In [20]:s.encode('ascii','ignore')
Steven D'Aprano wrote:
And how often do you have an list that you are creating where you don't
know what items you have to initialise the list with?
[snip]
You are right to point out that the third case is a Python gotcha: [[]]*n
doesn't behave as expected by the naive or inexperienced Python
MealWell supports Matt Tibbals, pedophile. He is working to legalize
sex with children over the age of 2.
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 09 Oct 2010 13:06:32 -0700, Bigos wrote:
[...]
> Maybe you have checked wrong version. There two versions of Ruby out
> there one does support unicode and the other doesn't.
Please don't feed the trolls. Xah Lee is a known troll who cross-posts to
irrelevant newsgroups with his blathering
On 10/7/2010 2:39 PM, kj wrote:
Following a suggestion from MRAB, I attempted to implement a
frozendict class.
That really should be built into the language. "dict" is the
last built-in type that doesn't have an immutable form.
John Nagle
--
http://mail.pyth
On Sat, 09 Oct 2010 12:44:29 -0700, chad wrote:
> Given the following...
>
> [cdal...@localhost oakland]$ python
> Python 2.6.2 (r262:71600, May 3 2009, 17:04:44) [GCC 4.1.1 20061011
> (Red Hat 4.1.1-30)] on linux2 Type "help", "copyright", "credits" or
> "license" for more information.
cla
2010-10-09
On Oct 9, 3:45 pm, Sean McAfee wrote:
> Xah Lee writes:
> > Perl's exceedingly lousy unicode support hack is well known. In fact
> > it is the primary reason i “switched” to python for my scripting needs
> > in 2005. (See: Unicode in Perl and Python)
>
> I think your assessment is ant
On Sat, 09 Oct 2010 21:39:51 +0100, Arnaud Delobelle wrote:
> 1. hash() is an idempotent function, i.e. hash(hash(x)) == hash(x) hold
> for any hashable x (this is a simple consequence of the fact that
> hash(x) == x for any int x (by 'int' I mean 2.X int)).
It's a beautiful theory, but, alas, it
Xah Lee writes:
> Perl's exceedingly lousy unicode support hack is well known. In fact
> it is the primary reason i “switched” to python for my scripting needs
> in 2005. (See: Unicode in Perl and Python)
I think your assessment is antiquated. I've been doing Unicode
programming with Perl for ab
chad writes:
> >>> print one
> <__main__.foo instance at 0xb7f3a2ec>
> >>> print two
> <__main__.foo instance at 0xb7f3a16c>
> >>> one.x
> 1
>
>
> Is 'one' a reference or a name space?
Yes.
It's a reference to an instance of the ‘foo’ type.
That instance is also a namespace; in other words, it
kj writes:
> In <87y6a9lqnj@gmail.com> Arnaud Delobelle writes:
>
>>You could do something like this:
>
>>deep_methods = {
>>list: lambda f, l: tuple(map(f, l)),
>>dict: lambda f, d: frozenset((k, f(v)) for k, v in d.items()),
>>set: lambda f, s: frozenset(map(f, s)),
>>
Johny writes:
> On Oct 9, 5:17 pm, Tim Harig wrote:
>> On 2010-10-09, Johny wrote:
>>
>> > Is it possible to control any webbrowser from Python ? For example to
>> > issue http POST and GET command
>>
>> The most reliable way to interact with a webserver is through the urllib
>> and httplib mo
On Oct 7, 7:13 pm, Xah Lee wrote:
> here's my experiences dealing with unicode in various langs.
>
> Unicode Support in Ruby, Perl, Python, Emacs Lisp
>
> Xah Lee, 2010-10-07
>
> I looked at Ruby 2 years ago. One problem i found is that it does not
> support Unicode well. I just checked today, it
In <87y6a9lqnj@gmail.com> Arnaud Delobelle writes:
>You could do something like this:
>deep_methods = {
>list: lambda f, l: tuple(map(f, l)),
>dict: lambda f, d: frozenset((k, f(v)) for k, v in d.items()),
>set: lambda f, s: frozenset(map(f, s)),
># Add more if needed
Given the following...
[cdal...@localhost oakland]$ python
Python 2.6.2 (r262:71600, May 3 2009, 17:04:44)
[GCC 4.1.1 20061011 (Red Hat 4.1.1-30)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class foo:
... x = 1
... y = 2
...
>>> one = foo()
>>> two =
On 09 Oct 2010 17:47:56 GMT
Seebs wrote:
> In other words, your problem here is that you haven't actually described
> what you want. Slow down. Think! Describe what you want clearly enough
> that any other person who reads your description can always come up with
> the same answer you would for
harryos writes:
> On Oct 9, 4:52 pm, Peter Otten <__pete...@web.de> wrote:
>
>>
>> You might get more/better answers if you tell us more about the context of
>> the problem and add some details that may be relevant.
>>
>> Peter
>
> I am trying to determine if a wep page is updated by x number of
What type of codec is the best to encode binary files what are upload to an
app write in Python 3?
On Oct 7, 2010 1:44pm, Tres Seaver wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 10/07/2010 12:17 PM, hid...@gmail.com
wrote:
> Hello list, i am develop an web app in Py
On Sat, Oct 9, 2010 at 10:47 AM, Seebs wrote:
> On 2010-10-09, harryos wrote:
>> What I meant by number of characters was the number of edits happened
>> between the two versions..
>
> Consider two strings:
>
> Hello, world!
>
> Yo, there.
>
> What is the "number of edits happened between the two
On 2010-10-09, harryos wrote:
> What I meant by number of characters was the number of edits happened
> between the two versions..
Consider two strings:
Hello, world!
Yo, there.
What is the "number of edits happened between the two versions"? It could
be:
* Zero. I just typed them both from
On Oct 9, 5:17 pm, Tim Harig wrote:
> On 2010-10-09, Johny wrote:
>
> > Is it possible to control any webbrowser from Python ? For example to
> > issue http POST and GET command
>
> The most reliable way to interact with a webserver is through the urllib
> and httplib modules. This is effective
On Oct 8, 2010, at 9:33 PM, Dennis Lee Bieber wrote:
On Fri, 8 Oct 2010 14:52:33 -0700, aurfal...@gmail.com declaimed the
following in gmane.comp.python.general:
Hi all,
Unsure how to deal with what appears to be \n vs \r issues.
The following code works in Linux;
o = open("axenfs.reg")
n =
On 2010-10-09, Johny wrote:
> Is it possible to control any webbrowser from Python ? For example to
> issue http POST and GET command
The most reliable way to interact with a webserver is through the urllib
and httplib modules. This is effective for 99% of cases. I do understand
that some site
> On Oct 9, 5:41 pm, Stefan Behnel wrote:
> > "Number of characters" sounds like a rather useless measure here.
>
> What I meant by number of characters was the number of edits happened
> between the two versions..Levenshtein distance may be one way for
> this..but I was wondering if difflib coul
> Is it possible to control any webbrowser from Python ? For example to
> issue http POST and GET command
> Thanks
> Johny
http://docs.python.org/library/webbrowser.html
The control you get is rather limited, though. If your aim is interacting with
a website, though, you can try urllib/urllib2
On Oct 9, 6:55 pm, Lawrence D'Oliveiro wrote:
> In message , BartC wrote:
>
> > "NevilleDNZ" wrote in message
> >news:ad9841df-49a1-4c1b-95d0-e76b72df6...@w9g2000prc.googlegroups.com...
>
> >> In Algol68 this would be:
> >> x:=(i|"One","Two","Three"|"None Of The Above")
>
> > The point is, the co
On Oct 9, 5:41 pm, Stefan Behnel wrote:
> "Number of characters" sounds like a rather useless measure here.
What I meant by number of characters was the number of edits happened
between the two versions..Levenshtein distance may be one way for
this..but I was wondering if difflib could do this
r
harryos, 09.10.2010 14:24:
I am trying to determine if a wep page is updated by x number of
characters..Mozilla firefox plugin 'update scanner' has a similar
functionality ..A user can specify the x ..I think this would be done
by reading from the same url at two different times and finding the
c
On Oct 9, 4:52 pm, Peter Otten <__pete...@web.de> wrote:
>
> You might get more/better answers if you tell us more about the context of
> the problem and add some details that may be relevant.
>
> Peter
I am trying to determine if a wep page is updated by x number of
characters..Mozilla firefox p
"Its the right answer for a program that needs to be used with many
different RDBMSes,
especially if you use its metadata access procedures."
U got it right :)
--
http://mail.python.org/mailman/listinfo/python-list
harryos wrote:
> but is there a way I can use difflib module to do this job?
I'm afraid I can't help you with that.
You might get more/better answers if you tell us more about the context of
the problem and add some details that may be relevant.
Peter
--
http://mail.python.org/mailman/listi
Well, if you need to issue http POST/GET commands, you can take a look
at urllib/urllib2 modules. Instead if you want to take control of the
web-browser I've heard about selenium, but I've never used it.
Best regards,
Matteo
On Sat, Oct 9, 2010 at 11:39 AM, Johny wrote:
> Is it possible to contr
alex23 writes:
> If anything, I feel like the list comp version is the correct solution
> because of its reliability, whereas the multiplication form feels like
> either a lucky naive approach or relies on the reader to know the type
> of the initialising value and its mutability.
Other than lis
On Oct 9, 2:45 pm, Peter Otten <__pete...@web.de> wrote:
>
> What would be an acceptable time?
>
Thanks for the reply Peter,
I was using python functions I came across the net..not cpython
implementations..Probably my low config machine is also to blame..(I
am no expert at judging algorithm perfo
harryos wrote:
> I am trying to write a compare method which takes two strings and find
> how many characters have changed.
>
>
> def compare_strings(s1,s2):
> pass
>
>
> text1="goat milk"
> text2="cow milk"
> print compare_strings(text1,text2)
>
> This must give 3 ,since 3 characters are
Is it possible to control any webbrowser from Python ? For example to
issue http POST and GET command
Thanks
Johny
--
http://mail.python.org/mailman/listinfo/python-list
harryos writes:
> hi
> I am trying to write a DataGrabber which reads some data from given
> url..I made DataGrabber as a Thread and want to wait for some interval
> of time in case there is a network failure that prevents read().
> I am not very sure how to implement this
>
> class DataGrabber(
In message , BartC wrote:
> "NevilleDNZ" wrote in message
> news:ad9841df-49a1-4c1b-95d0-e76b72df6...@w9g2000prc.googlegroups.com...
>
>> In Algol68 this would be:
>> x:=(i|"One","Two","Three"|"None Of The Above")
>
> The point is, the construction works well when the syntax fully supports
> it.
hi
I am trying to write a compare method which takes two strings and find
how many characters have changed.
def compare_strings(s1,s2):
pass
text1="goat milk"
text2="cow milk"
print compare_strings(text1,text2)
This must give 3 ,since 3 characters are changed between strings.I was
advised
55 matches
Mail list logo