Robert Kern wrote:
> Please
> follow our advice. Split using b'\r\n\r\n' and use the maxsplit=1 argument to
> make sure that you do not split on spurious b'\r\n\r\n' sequences inside the
> JPEG body. Do not decode the bytes.
Correct, and I'll add that this is a case where we might want to be
bette
On Wed, Aug 25, 2010 at 05:04, Lawrence D'Oliveiro
wrote:
> In message , Nobody wrote:
>
>> Having this as a separate permission allows normal users to add entries to
>> log files but not to erase existing entries.
>
> Unix/Linux systems can do this already.
Ooh, I didn't know that -- what combin
On Fri, 27 Aug 2010 13:28:46 +0600, Rami Chowdhury wrote:
>>> Having this as a separate permission allows normal users to add entries
>>> to log files but not to erase existing entries.
>>
>> Unix/Linux systems can do this already.
>
> Ooh, I didn't know that -- what combination of permissions wo
On Thu, 26 Aug 2010 23:56:26 -0700, Bryan wrote:
>> follow our advice. Split using b'\r\n\r\n' and use the maxsplit=1
>> argument to make sure that you do not split on spurious b'\r\n\r\n'
>> sequences inside the JPEG body. Do not decode the bytes.
>
> Correct, and I'll add that this is a case wh
level: beginner
the following code looks ok to me but it doesn't work. I would like
some hints as to where my reasoning / thought goes wrong
def i_palindrome(pal):
while len(pal)>1:
if pal[0] == pal[-1]:
pal=pal[1:-1]
return True
print i_palindrome('annab')
my reasoning:
- i check the l
One possible reason I can think of -
"- exiting this loop means all compared chars were identical hence it
is a palindrome and i return True"
is probably incorrect reasoning. Think again.
Also, you may consider posting your code in a way that preserves the
whitespace characters.
Cheers,
Xav
On
Baba wrote:
> level: beginner
>
> the following code looks ok to me but it doesn't work. I would like
> some hints as to where my reasoning / thought goes wrong
>
> def i_palindrome(pal):
> while len(pal)>1:
> if pal[0] == pal[-1]:
>pal=pal[1:-1]
> return True
Do yourself a favour and u
Baba a écrit :
level: beginner
the following code looks ok to me but it doesn't work.
"doesn't work" is about the most useless description of a problem.
Please specify what you expected and what actually happens.
I would like
some hints as to where my reasoning / thought goes wrong
def i_
> Now there is another solution. A palindrom is made of two symetric halves,
> with (odd len) or without (even len) a single char between the symetric
> halves, ie :
>
> * odd : ABCBA ('AB' + 'C' + 'BA')
> * even : ABCCBA ('ABC' + 'CBA')
>
> So you just have to extract the symetric halves, reverse
On 26 Aug., 13:16, steph wrote:
> Hi group,
>
> I've written a small application that puts images into a pdf document.
> It works ok, but my problem is that the pdf-files become quite huge,
> bigger than the original jpegs. The problem seems to arise because I
> use PIL to resize the pictures - an
> Yes, this is a correct observation, but it is not necessary to compare
> the halves; Simply compare the complete string with its reverse. If
> they match, it is a palindrome.
I've always used to implement the is_palindrome function as you
suggest, i.e. comparing the original string with the reve
Bruno Desthuilliers wrote:
Baba a
écrit :
level: beginner
the following code looks ok to me but it doesn't work.
"doesn't work" is about the most useless description of a problem.
Please specify what you expected and what actually happens.
I would like
some hints as to where my reasonin
Nobody wrote:
> Bryan wrote:
> > this is a case where we might want to be better
> > than correct. BaseHTTPRequestHandler in the Python standard library
> > accommodates clients that incorrectly omit the '\r' and end header lines
> > with just '\n'. Such apps have been seen in the wild. Since bare
Richard Arts a écrit :
Now there is another solution. A palindrom is made of two symetric halves,
with (odd len) or without (even len) a single char between the symetric
halves, ie :
* odd : ABCBA ('AB' + 'C' + 'BA')
* even : ABCCBA ('ABC' + 'CBA')
So you just have to extract the symetric halve
Dave Angel a écrit :
(snip)
or (untested)
def is_palindrom(s):
s = s.lower()
return s == s[::-1]
Right, go on, make me feel a bit more stupid :-/
Who's next ?
--
http://mail.python.org/mailman/listinfo/python-list
In article <2dd74ab4-5ed6-40ac-aea7-705977b61...@g21g2000prn.googlegroups.com>,
fuglyducky wrote:
>
>I am a complete newbie to Python (and programming in general) and I
>have no idea what I'm missing. Below is a script that I am trying to
>work with and I cannot get it to work.
Side note: while
On Fri, 27 Aug 2010 11:49:42 -0400
"D'Arcy J.M. Cain" wrote:
> is_palindrome = lambda x: x == x.lower()[::-1]
Oops. Simple and wrong.
is_palindrome = lambda x: x.lower() == x.lower()[::-1]
--
D'Arcy J.M. Cain | Democracy is three wolves
http://www.druid.net/darcy/|
On 27/08/2010 15:43, Bruno Desthuilliers wrote:
Dave Angel a écrit :
(snip)
or (untested)
def is_palindrom(s):
s = s.lower()
return s == s[::-1]
Right, go on, make me feel a bit more stupid :-/
Who's next ?
It could be worse, try responding to issue 9702. :)
Cheers.
Mark Lawrence.
--
h
layer geld verdienen , leicht geldverdienen , wie kann ich
onlinespiele geld gewinnen , geldgewinnspiele , zu geld machen , geld
machen beim , pennergame geld verdienen , schnell geld vedienen , ohne
geld online , geld mit online casino ,
*
*
*
+++ SOFORT GEWINN +++ REICH WERDEN +++
*
http://WWW.S
On 27/08/2010 09:53, Baba wrote:
level: beginner
the following code looks ok to me but it doesn't work. I would like
some hints as to where my reasoning / thought goes wrong
def i_palindrome(pal):
while len(pal)>1:
if pal[0] == pal[-1]:
pal=pal[1:-1]
return True
print i_palindrome(
My university has a cluster computer, on which I want to run my python
program that uses numpy.
I am installing my Python2.7 locally separated from the main system,
and trying to install numpy, attach it with Python2.7.
I used many different versions of numpys to make it happen, but I got
stuck wit
On Fri, 27 Aug 2010 16:43:16 +0200
Bruno Desthuilliers wrote:
> Dave Angel a écrit :
> > def is_palindrom(s):
> >s = s.lower()
> >return s == s[::-1]
>
>
> Right, go on, make me feel a bit more stupid :-/
> Who's next ?
How about a one-liner?
is_palindrome = lambda x: len(x)> 0 and x =
In article ,
MRAB wrote:
>
>An object will be available for garbage collection when nothing refers
>to it either directly or indirectly. If it's unreferenced then it will
>go away.
This isn't actually garbage collection as most people think of it.
Refcounting semantics mean that objects get reap
On 27/08/2010 17:20, Mark Lawrence wrote:
On 27/08/2010 15:43, Bruno Desthuilliers wrote:
Dave Angel a écrit :
(snip)
or (untested)
def is_palindrom(s):
s = s.lower()
return s == s[::-1]
Right, go on, make me feel a bit more stupid :-/
Who's next ?
It could be worse, try responding to is
On 8/27/10 11:40 AM, justin wrote:
My university has a cluster computer, on which I want to run my python
program that uses numpy.
I am installing my Python2.7 locally separated from the main system,
and trying to install numpy, attach it with Python2.7.
I used many different versions of numpys t
On 27/08/2010 17:53, MRAB wrote:
On 27/08/2010 17:20, Mark Lawrence wrote:
On 27/08/2010 15:43, Bruno Desthuilliers wrote:
Dave Angel a écrit :
(snip)
or (untested)
def is_palindrom(s):
s = s.lower()
return s == s[::-1]
Right, go on, make me feel a bit more stupid :-/
Who's next ?
It co
On 8/27/2010 4:53 AM, Baba wrote:
level: beginner
the following code looks ok to me but it doesn't work. I would like
some hints as to where my reasoning / thought goes wrong
def i_palindrome(pal):
while len(pal)>1:
if pal[0] == pal[-1]:
pal=pal[1:-1]
return True
print i_palindrome(
On 27/08/2010 18:28, Mark Lawrence wrote:
On 27/08/2010 17:53, MRAB wrote:
On 27/08/2010 17:20, Mark Lawrence wrote:
On 27/08/2010 15:43, Bruno Desthuilliers wrote:
Dave Angel a écrit :
(snip)
or (untested)
def is_palindrom(s):
s = s.lower()
return s == s[::-1]
Right, go on, make me feel
Ian writes:
> If you want to or must do it recursively.
> (Shown in pseudo code to make the logic clearer)
>
> def isPalindrome(pal)
> ''' test pal (a list) is a palindrome '''
> if length of pal = 1
> return True # all one letter strings are palindromes.
> if first equal
Even if you replace the python mbox code with something that uses
fcntl.flock() to protect against concurrent updating, you should also
understand that NFS does *not* provide full Unix filesystem semantics.
In particular, Unix flock(2) (which Python's fcntl.flock() wraps)
doesn't work over NFS.
Th
On Aug 27, 12:10 pm, Robert Kern wrote:
> On 8/27/10 11:40 AM, justin wrote:
>
>
>
>
>
> > My university has a cluster computer, on which I want to run my python
> > program that uses numpy.
> > I am installing my Python2.7 locally separated from the main system,
> > and trying to install numpy, a
Jussi Piitulainen wrote:
Ian writes:
If you want to or must do it recursively.
(Shown in pseudo code to make the logic clearer)
def isPalindrome(pal)
''' test pal (a list) is a palindrome '''
if length of pal = 1
return True # all one letter strings are palindromes.
On 8/27/10 1:38 PM, justin wrote:
On Aug 27, 12:10 pm, Robert Kern wrote:
On 8/27/10 11:40 AM, justin wrote:
My university has a cluster computer, on which I want to run my python
program that uses numpy.
I am installing my Python2.7 locally separated from the main system,
and trying to i
On Fri, 27 Aug 2010 12:02:39 -0400
"D'Arcy J.M. Cain" wrote:
> On Fri, 27 Aug 2010 11:49:42 -0400
> "D'Arcy J.M. Cain" wrote:
> > is_palindrome = lambda x: x == x.lower()[::-1]
>
> Oops. Simple and wrong.
>
> is_palindrome = lambda x: x.lower() == x.lower()[::-1]
slightly more efficient I thi
Dave Angel writes:
> Jussi Piitulainen wrote:
>> Ian writes:
>>> Of course, the simpler way is to use the definition of a
>>> Palindrome as the same backwards and forwards.
>>>
>>> def isPalindrome(pal)
>>> return pal == pal.reverse
>>
>> Agreed. But is there any nicer way to spell .reverse t
On 8/11/2010 1:26 PM, EW wrote:
On Aug 11, 2:52 pm, Paul Rubin wrote:
EW writes:
Well I cared because I thought garbage collection would only happen
when the script ended - the entire script. Since I plan on running
this as a service it'll run for months at a time without ending. So I
thoug
On 27/08/2010 20:43, Jussi Piitulainen wrote:
Dave Angel writes:
Jussi Piitulainen wrote:
Ian writes:
Of course, the simpler way is to use the definition of a
Palindrome as the same backwards and forwards.
def isPalindrome(pal)
return pal == pal.reverse
Agreed. But is there any nicer
On 8/10/2010 2:25 AM, Chris Rebert wrote:
On Tue, Aug 10, 2010 at 2:01 AM, wrote:
Tim Roberts wrote:
tinn...@isbd.co.uk wrote:
I'm using the python mailbox class in a script that processes incoming
mail and delivers it to various mbox format mailboxes. It appears
that, although I am callin
MRAB writes:
> On 27/08/2010 20:43, Jussi Piitulainen wrote:
>> Dave Angel writes:
>>> Jussi Piitulainen wrote:
Agreed. But is there any nicer way to spell .reverse than [::-1]
in Python? There is .swapcase() but no .reverse(), right?
>>> There can't be a .reverse() method on string,
On 8/27/2010 3:43 PM, Jussi Piitulainen wrote:
Dave Angel writes:
There could easily be a .reverse() method on strings. It would return
the reversed string, like .swapcase() returns the swapcased string.
Could be, but the main use case seems to be for palindrome testing ;-)
Given that slicin
On Fri, Aug 27, 2010 at 10:51 PM, Jussi Piitulainen
wrote:
> MRAB writes:
>> On 27/08/2010 20:43, Jussi Piitulainen wrote:
>>> Dave Angel writes:
Jussi Piitulainen wrote:
> Agreed. But is there any nicer way to spell .reverse than [::-1]
> in Python? There is .swapcase() but no .rever
On Fri, Aug 27, 2010 at 11:47 PM, Richard Arts wrote:
> On Fri, Aug 27, 2010 at 10:51 PM, Jussi Piitulainen
> wrote:
>> MRAB writes:
>>> On 27/08/2010 20:43, Jussi Piitulainen wrote:
Dave Angel writes:
> Jussi Piitulainen wrote:
>> Agreed. But is there any nicer way to spell .reverse
In message
, Navkirat Singh wrote:
> I receive a jpeg file with the POST method.The file (.jpeg) is encoded in
> bytes, I parse the bytes by decoding them to a string. I wanted to know
> how i could write the file (now a string) as a jpeg image on disk.
I assume the JPEG data is received along wi
In message , Navkirat
Singh wrote:
> The image bytes are a part of a HTTP header content ( not the message body
> ).
In which case, won’t they be in some encoding like Base-64? I don’t think
you’re allowed arbitrary binary bytes in an HTTP header.
--
http://mail.python.org/mailman/listinfo/pyt
In message , Rami
Chowdhury wrote:
> On Wed, Aug 25, 2010 at 05:04, Lawrence D'Oliveiro
> wrote:
>
>> In message , Nobody wrote:
>>
>>> Having this as a separate permission allows normal users to add entries
>>> to log files but not to erase existing entries.
>>
>> Unix/Linux systems can do this
On 8/27/10 5:58 PM, Lawrence D'Oliveiro wrote:
In message
, Navkirat Singh wrote:
I receive a jpeg file with the POST method.The file (.jpeg) is encoded in
bytes, I parse the bytes by decoding them to a string. I wanted to know
how i could write the file (now a string) as a jpeg image on disk.
ActiveState is pleased to announce ActivePython 2.6.6.15, a complete,
ready-to-install binary distribution of Python 2.6.6.
http://www.activestate.com/activepython
What's New in ActivePython-2.6.6.15
===
*Release date: 25-Aug-2010*
New Features & Upgrades
-
ActiveState is pleased to announce ActivePython 2.7.0.2, a complete,
ready-to-install binary distribution of Python 2.7.
http://www.activestate.com/activepython
What's New in ActivePython-2.7.0.2
==
*Release date: 25-Aug-2010*
New Features & Upgrades
--
In message <4c74e604.6090...@sschwarzer.net>, Stefan Schwarzer wrote:
> Now it may be that the data connection, after having started
> the transfer, works as it should, but the control connection
> times out because the duration of the transfer is too long.
It might not be the fault of the FTP se
Hi! Does anyone know of an easy way to convert a Unicode string into an image
file (either jpg or png)?
TIA!
~k
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 25, 5:18 pm, Ross Williamson
wrote:
> Hi All
>
> Is there anyway in a class to overload the print function?
>
> >> class foo_class():
> >> pass
> >> cc = foo_class()
> >> print cc
>
> Gives:
>
> <__main__.foo_class instance at >
>
> Can I do something like:
>
> >> class foo_class()
On Fri, 27 Aug 2010 09:16:52 -0700, Aahz wrote:
> In article , MRAB
> wrote:
>>
>>An object will be available for garbage collection when nothing refers
>>to it either directly or indirectly. If it's unreferenced then it will
>>go away.
>
> This isn't actually garbage collection as most people
On Fri, Aug 27, 2010 at 8:01 PM, kj wrote:
>
>
> Hi! Does anyone know of an easy way to convert a Unicode string into an
> image file (either jpg or png)?
>
Do you mean you have some text and you want an image containing that
text? PIL's ImageDraw module can do that.
--
http://mail.python.org/
Steven D'Aprano writes:
> I've repeatedly asked, both here and elsewhere, why reference counting
> isn't "real" garbage collection. Nobody has been able to give me a
> satisfactory answer. As far as I can tell, it's a bit of pretentiousness
> with no basis in objective fact.
Well, it's a bit o
www.127760.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list
1st step
like me on facbook at this link
http://www.facebook.com/pages/loveme/145529285481739
2nd step
visit this link http://www.kqzyfj.com/click-3778203-10786395
--
http://mail.python.org/mailman/listinfo/python-list
This is all about walking trees, recursion and generators. None of which
fit my brain at all!
From an XML tree (an SVG file) I build a bunch of Tag objects.
[I use lxml, but I am combining multiple svg files into a 'forest' of
trees, so I can't use the lxml walking methods because they all sto
In message , Tim Golden
wrote:
> Can you run Python from within a Run-As-Administrator command
> prompt?
Kind of worrying, isn’t it, when the answer to “my program won’t work” is
“give it more privileges”? Defeats the point of having such a complex
security system, doesn’t it, when people are
i want to know that what this function returns???
and what does this function do??
--
http://mail.python.org/mailman/listinfo/python-list
Terry Reedy writes:
> On 8/27/2010 3:43 PM, Jussi Piitulainen wrote:
> > Dave Angel writes:
>
> > There could easily be a .reverse() method on strings. It would return
> > the reversed string, like .swapcase() returns the swapcased string.
>
> Could be, but the main use case seems to be for palin
donn wrote:
> * If an Instance calls a method on another Instance of the same
> class, is this still recursion? And how does this 'stack up'? I mean,
> literally, on the stack. Does each instance get its own stack, or does
> all the push, call, pop stuff happen in one main stack?
> (I worry about
61 matches
Mail list logo