On 08/30/2013 11:07 PM, Fabrice Pombet wrote:
... long discussion elided ...
well, look at that:
a=(1,2)
a=2+3 ->a is an object and I have changed its type and value from outside. As
far as I am concerned this is one hell of an encapsulation violation... Could you
do this -strictly speaking- i
Στις 31/8/2013 9:53 πμ, ο/η Chris Angelico έγραψε:
On Sat, Aug 31, 2013 at 4:41 PM, Ferrous Cranus wrote:
Suddenly my webiste superhost.gr running my main python script presents me
with this error:
Code:
UnicodeDecodeError('utf-8', b'\xb6\xe3\xed\xf9\xf3\xf4\xef
\xfc\xed\xef\xec\xe1 \xf3\xf5\x
Στις 31/8/2013 10:02 πμ, ο/η Ferrous Cranus έγραψε:
Στις 31/8/2013 9:53 πμ, ο/η Chris Angelico έγραψε:
On Sat, Aug 31, 2013 at 4:41 PM, Ferrous Cranus
wrote:
Suddenly my webiste superhost.gr running my main python script
presents me
with this error:
Code:
UnicodeDecodeError('utf-8', b'\xb6\xe
Ferrous Cranus wrote:
> Suddenly my webiste superhost.gr running my main python script presents
> me with this error:
> Code:
> UnicodeDecodeError('utf-8', b'\xb6\xe3\xed\xf9\xf3\xf4\xef
> \xfc\xed\xef\xec\xe1 \xf3\xf5\xf3\xf4\xde\xec\xe1\xf4\xef\xf2', 0, 1,
> 'invalid start byte')
> Does anyo
On Saturday, August 31, 2013 9:03:58 AM UTC+2, Gary Herron wrote:
> On 08/30/2013 11:07 PM, Fabrice Pombet
> wrote:
>
>
> ... long discussion elided ...
>
> well, look at that:
>
> a=(1,2)
> a=2+3 ->a is an object and I have changed its type and value from outside. As
> far
Steven D'Aprano writes:
> We really are spoiled for choice here. We can write any of these:
>
> # Option 1
> for spam in sequence:
> if predicate(spam):
> process(spam)
# Option 1.5
for spam in sequence:
if not predicate(spam): continue
process(spam)
This saves an indent lev
Στις 31/8/2013 10:25 πμ, ο/η Peter Otten έγραψε:
Ferrous Cranus wrote:
Suddenly my webiste superhost.gr running my main python script presents
me with this error:
Code:
UnicodeDecodeError('utf-8', b'\xb6\xe3\xed\xf9\xf3\xf4\xef
\xfc\xed\xef\xec\xe1 \xf3\xf5\xf3\xf4\xde\xec\xe1\xf4\xef\xf2',
On Saturday, August 31, 2013 9:42:55 AM UTC+2, Fabrice Pombet wrote:
> On Saturday, August 31, 2013 9:03:58 AM UTC+2, Gary Herron wrote:
>
> > On 08/30/2013 11:07 PM, Fabrice Pombet
>
> > wrote:
>
> >
>
> >
>
> > ... long discussion elided ...
>
> >
>
> > well, look at
Jussi Piitulainen writes:
> # Option 1.5
> for spam in sequence:
> if not predicate(spam): continue
> process(spam)
>
> This saves an indent level.
Just out of interest: is saving an indent level a useful thing?
I wouldn't lay out my code like that just because if you're coming back
to
What is the equivalent in Python 3 to the following Python 2 code:
# -
for i in range(5):
print i,
# -
?
Be careful that the above code doesn't add a trailing space after the
last number in the list, hence the following Python 3 code
Hi again,
sorry for replying to my own mail, but is there really no solution? Can
curses really not be used in this situation?
Thanks again,
Timo
On Sun, Aug 11, 2013 at 02:05:11PM +0200, Timo Schmiade wrote:
> Hi all,
>
> I wrote a replacement for urlview to properly extract URLs from emails.
Here is the code inside files.py:
try:
gi = pygeoip.GeoIP('/usr/local/share/GeoIPCity.dat')
city = gi.time_zone_by_addr( os.environ['REMOTE_ADDR'] ) or
gi.time_zone_by_addr( os.environ['HTTP_CF_CONNECTING_IP'] )
host = socket.gethostbyaddr( os.environ['REMOTE_ADDR'] ) or
socket.getho
On 31.08.2013 10:17, candide wrote:
What is the equivalent in Python 3 to the following Python 2 code:
# -
for i in range(5):
print i,
# -
?
How about
>>> print(" ".join(str(i) for i in range(5)))
0 1 2 3 4
Bye, Andreas
--
ht
Le 31/08/2013 10:43, Andreas Perstinger a écrit :
> How about
>
> >>> print(" ".join(str(i) for i in range(5)))
> 0 1 2 3 4
>
Thanks for your answer. The output is stricly the same but the code
doesn't suit my needs :
1) I'm porting to Python 3 a Python 2 full beginner course : the
learner
Paul Rudin writes:
> Jussi Piitulainen writes:
>
> > # Option 1.5
> > for spam in sequence:
> > if not predicate(spam): continue
> > process(spam)
> >
> > This saves an indent level.
>
> Just out of interest: is saving an indent level a useful thing?
It might be if process(spam) is a mor
candide wrote:
> Le 31/08/2013 10:43, Andreas Perstinger a écrit :
>
> > How about
> >
> > >>> print(" ".join(str(i) for i in range(5)))
> > 0 1 2 3 4
> >
>
>
> Thanks for your answer. The output is stricly the same but the code
> doesn't suit my needs :
>
> 1) I'm porting to Python 3 a
On Sat, 31 Aug 2013 10:17:23 +0200, candide wrote:
> What is the equivalent in Python 3 to the following Python 2 code:
>
> # -
> for i in range(5):
> print i,
> # -
>
> ?
>
> Be careful that the above code doesn't add a trailing spac
On 8/31/13 4:17 AM, candide wrote:
What is the equivalent in Python 3 to the following Python 2 code:
# -
for i in range(5):
print i,
# -
?
Be careful that the above code doesn't add a trailing space after the
last number in the lis
On Sat, 31 Aug 2013 11:31:13 +0300, Ferrous Cranus wrote:
> Here is the code inside files.py:
The code you show is not the ENTIRE code inside of files.py, is it? You
are only showing us a small piece, correct?
The code you show:
> try:
> gi = pygeoip.GeoIP('/usr/local/share/GeoIPCity.dat
On Fri, 30 Aug 2013 23:07:47 -0700, Fabrice Pombet wrote:
> well, look at that:
>
> a=(1,2)
> a=2+3 ->a is an object and I have changed its type and value from
> outside.
Incorrect. You have not changed the type or value of any object. "a" is
not an object, it is a *name*, and while you can ch
Steven D'Aprano wrote:
> On Sat, 31 Aug 2013 10:17:23 +0200, candide wrote:
>
>> What is the equivalent in Python 3 to the following Python 2 code:
>>
>> # -
>> for i in range(5):
>> print i,
>> # -
>>
>> ?
>>
>> Be careful that the
On 31 August 2013 12:16, Steven D'Aprano
wrote:
> On Sat, 31 Aug 2013 10:17:23 +0200, candide wrote:
>
>> What is the equivalent in Python 3 to the following Python 2 code:
>>
>> # -
>> for i in range(5):
>> print i,
>> # -
>>
>> ?
>>
>>
On 8/31/13 7:46 AM, Steven D'Aprano wrote:
On Fri, 30 Aug 2013 23:07:47 -0700, Fabrice Pombet wrote:
well, look at that:
a=(1,2)
a=2+3 ->a is an object and I have changed its type and value from
outside.
Incorrect. You have not changed the type or value of any object. "a" is
not an object, it
>
> http://nedbatchelder.com/text/names.html
>
>
>
> --Ned.
This is an excellent explanation, thank you. It is mostly of theoretical
interest though, and in practice, I still contend that the consequences towards
the syntax are (or seem, if you prefer) analogous to those of the lack of
enc
On Saturday, August 31, 2013 1:46:52 PM UTC+2, Steven D'Aprano wrote:
> On Fri, 30 Aug 2013 23:07:47 -0700, Fabrice Pombet wrote:
>
>
>
> > well, look at that:
>
> >
>
> > a=(1,2)
>
> > a=2+3 ->a is an object and I have changed its type and value from
>
> > outside.
>
>
>
> Incorrect. Y
Στις 31/8/2013 2:28 μμ, ο/η Steven D'Aprano έγραψε:
On Sat, 31 Aug 2013 11:31:13 +0300, Ferrous Cranus wrote:
Here is the code inside files.py:
The code you show is not the ENTIRE code inside of files.py, is it? You
are only showing us a small piece, correct?
The code you show:
try:
Le 31/08/2013 13:16, Steven D'Aprano a écrit :
Of course it does. Have you actually tried it?
Of course I did, redirecting the output to a file in order to spot an
eventually trailing space. I did the same for the Python 3 code.
--
http://mail.python.org/mailman/listinfo/python-list
Στις 31/8/2013 3:58 μμ, ο/η Ferrous Cranus έγραψε:
Στις 31/8/2013 2:28 μμ, ο/η Steven D'Aprano έγραψε:
On Sat, 31 Aug 2013 11:31:13 +0300, Ferrous Cranus wrote:
Here is the code inside files.py:
The code you show is not the ENTIRE code inside of files.py, is it? You
are only showing us a sma
Le 31/08/2013 12:31, Peter Otten a écrit :
> softspace = False
> for i in range(5):
> if softspace:
> print(end=" ")
> print(i, end="")
> softspace = True
> print()
The if instruction imposes useless testing (we know in advance the
problem to occur at the very end of the
Le 31/08/2013 13:24, Ned Batchelder a écrit :
For a beginner course, the trailing space is fine, use this code.
I was really expecting there was a trick but I'll follow your advice,
after all the trailing space is invisible!
Nevertheless, this can be quite annoying. For instance, some autom
candide wrote:
> Le 31/08/2013 12:31, Peter Otten a écrit :
> > softspace = False
> > for i in range(5):
> > if softspace:
> > print(end=" ")
> > print(i, end="")
> > softspace = True
> > print()
>
>
> The if instruction imposes useless testing (we know in advance
Hi, I need to create a HMAC in Python just the way the following Javascript
code does:
var credentials = "admin:amin";
key="4545453030303743303134462035343733373432363420323031332D30382D33312031343A33353A3035"
var shaObj = new jsSHA(credentials, "ASCII");
var hash = shaObj.getHMAC(key, "HEX", "HE
In article <3479e08e-d435-492b-b2a0-a1c18678f...@googlegroups.com>,
sergio7...@gmail.com wrote:
> key="4545453030303743303134462035343733373432363420323031332D30382D33312031343A33353A3035"
> key="4545453030303743303134462035343733373432363420323031332D30382D33312031343A33353A303$
To start with,
El sábado, 31 de agosto de 2013 16:39:08 UTC+2, Roy Smith escribió:
> In article <3479e08e-d435-492b-b2a0-a1c18678f...@googlegroups.com>,
>
> sergio7...@gmail.com wrote:
>
>
>
> > key="4545453030303743303134462035343733373432363420323031332D30382D33312031343A33353A3035"
>
> > key="4545453030
Hi;
Since there is no list for MySQLdb, I'm hoping you can help me. I have
installed, de-installed and reinstalled this s/w and MySQL itself on my Win8
box. However, when I go to use it from a script, I get the following error:
"C:\Python27\lib\site-packages\MySQLdb\__init.py__", line 27 in
imp
In article ,
Sergio Sanchez wrote:
> > To start with, your keys are not the same
>
> Sorry, that was a problem with the cut & paste.
And your credentials are different too:
var credentials = "admin:amin";
credentials = "admin:admin"
Is this also a cut & paste error?
Please, post EXACTlY the
On Sat, Aug 31, 2013 at 6:38 PM, John Smith
wrote:
> Hi;
> Since there is no list for MySQLdb, I'm hoping you can help me. I have
> installed, de-installed and reinstalled this s/w and MySQL itself on my Win8
> box. However, when I go to use it from a script, I get the following error:
>
> "C:\P
El sábado, 31 de agosto de 2013 16:48:53 UTC+2, Sergio Sanchez escribió:
> El sábado, 31 de agosto de 2013 16:39:08 UTC+2, Roy Smith escribió:
>
> > In article <3479e08e-d435-492b-b2a0-a1c18678f...@googlegroups.com>,
>
> >
>
> > sergio7...@gmail.com wrote:
>
> >
>
> >
>
> >
>
> > > ke
On Sat, 31 Aug 2013 14:59:17 +0200, candide wrote:
> Le 31/08/2013 13:16, Steven D'Aprano a écrit :
>
>
>> Of course it does. Have you actually tried it?
>
>
> Of course I did, redirecting the output to a file in order to spot an
> eventually trailing space. I did the same for the Python 3 cod
On Sat, Aug 31, 2013 at 11:33 PM, candide wrote:
> The if instruction imposes useless testing (we know in advance the problem
> to occur at the very end of the loop) and useless writing (writing '').
>
> The following is clearer
>
> # -
> n=5
> for i in range(n-1):
> pr
On 31 August 2013 16:30, Chris Angelico wrote:
>>
>> but doesn't solve all the cases (imagine a string or an iterator).
>
> Similar but maybe simpler, and copes with more arbitrary iterables:
>
> it=iter(range(5))
> print(next(it), end='')
> for i in it:
> print('',i, end='')
If you want to w
On Sat, 31 Aug 2013 15:58:11 +0300, Ferrous Cranus wrote:
Failure is here, line 135:
>> cur.execute('''INSERT INTO files (url, host, city, lastvisit) VALUES
>> (%s, %s, %s, %s)''', (filename, host, city, lastvisit) ),
[...]
> But how is this possible since:
>
>
> host = socket.gethostbyaddr( o
Le 31/08/2013 12:31, Peter Otten a écrit :
with `softspace` saved as a file attribute, is gone in Python3.
After reading
http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function
I understand what you meant by "softspace". Thanks.
--
http://mail.python.org/mailman/listinfo/python-l
Le 31/08/2013 15:59, Peter Otten a écrit :
To make it crystal clear, the above was to illustrate the algorithm used in
Python 2, not a suggestion.
Ok sorry, I misinterpreted.
> I still think you should live with a trailing space
Are you sure ? The following code
#
When using argparse, is there a way to specify in what order arguments
get parsed? I am writing a script whose parameters can be modified in
the following order:
Defaults -> config file -> command-line switches.
However, I want to give the option of specifying a config file using a
command line s
On 1 September 2013 03:31, Dennis Lee Bieber wrote:
> On Fri, 30 Aug 2013 23:07:47 -0700 (PDT), Fabrice Pombet >
> declaimed the following:
>
> >well, look at that:
> >
> >a=(1,2)
> >a=2+3 ->a is an object and I have changed its type and value from
> outside. As far as I am concerned this is one
On 2013-08-31 13:11, Eduardo Alvarez wrote:
> When using argparse, is there a way to specify in what order
> arguments get parsed? I am writing a script whose parameters can be
> modified in the following order:
>
> Defaults -> config file -> command-line switches.
>
> However, I want to give the
On 8/31/2013 1:11 PM, Eduardo Alvarez wrote:
When using argparse, is there a way to specify in what order arguments
get parsed?
I expect argparse to forward iterate the sequence of arguments that it
receives.
I am writing a script whose parameters can be modified in
the following order:
De
On 8/31/2013 2:13 PM, Terry Reedy wrote:
On 8/31/2013 1:11 PM, Eduardo Alvarez wrote:
When using argparse, is there a way to specify in what order arguments
get parsed?
I expect argparse to forward iterate the sequence of arguments that it
receives.
Aside from the environment variable soluti
On Sun, Sep 1, 2013 at 1:43 AM, Oscar Benjamin
wrote:
> On 31 August 2013 16:30, Chris Angelico wrote:
>>>
>>> but doesn't solve all the cases (imagine a string or an iterator).
>>
>> Similar but maybe simpler, and copes with more arbitrary iterables:
>>
>> it=iter(range(5))
>> print(next(it), en
On Sun, Sep 1, 2013 at 8:17 AM, John Smith wrote:
>
>
> On Sat, 31/8/13, Chris Angelico wrote:
>
> Subject: Re: MySQLdb Problem
> To: python-list@python.org
> Date: Saturday, 31 August, 2013, 4:18 PM
>
>> Do your Python and your MySQLdb match? I hav
On 31 August 2013 23:08, Chris Angelico wrote:
> On Sun, Sep 1, 2013 at 1:43 AM, Oscar Benjamin
> wrote:
>> On 31 August 2013 16:30, Chris Angelico wrote:
but doesn't solve all the cases (imagine a string or an iterator).
>>>
>>> Similar but maybe simpler, and copes with more arbitrary
On 31 August 2013 01:13, Steven D'Aprano
wrote:
> On Fri, 30 Aug 2013 06:35:47 -0400, Roy Smith wrote:
>
>> In article <52200699$0$6599$c3e8da3$54964...@news.astraweb.com>,
>> Steven D'Aprano wrote:
>>
>>> These days, it would be relatively simple to implement pre- and post-
>>> condition checki
Hello Everyone,
I'm writing a processor for Bitmessage messages and I am needing to
parse the following returned JSON string:
{u'inboxMessages': [{u'fromAddress':
u'BM-2DBYkhiBZCyrBa8J7gFRGrFRSGqtHgPtMvwQ', u'toAddress':
u'BM-2DC7SCTj2gzgrGgMvUCARdrfrsgLyz3iMyN3', u'read': 0, u'msgid':
u'36659a44
On Sun, Sep 1, 2013 at 9:44 AM, Anthony Papillion wrote:
> I'm writing a processor for Bitmessage messages and I am needing to
> parse the following returned JSON string:
>
> {u'inboxMessages':
Does the JSON string really have those u prefixes and apostrophes?
That's not valid JSON. You may be ab
On Sat, 31/8/13, Chris Angelico wrote:
Subject: Re: MySQLdb Problem
To: python-list@python.org
Date: Saturday, 31 August, 2013, 4:18 PM
> Do your Python and your MySQLdb match? I haven't confirmed,
> but I'm
> pretty sure you'll have problems if
On 8/31/2013 7:15 PM, Joshua Landau wrote:
On 31 August 2013 23:08, Chris Angelico wrote:
On Sun, Sep 1, 2013 at 1:43 AM, Oscar Benjamin
wrote:
On 31 August 2013 16:30, Chris Angelico wrote:
but doesn't solve all the cases (imagine a string or an iterator).
Similar but maybe simpler, and
Hi,
At startup, IPython (qtconsole) calls
"socket.gethostbyname_ex(socket.gethostname())[2]" to find a list of IP
addresses that point to the machine. On a Linux server that I manage this call
is extremely slow (>20s)... which I have trouble understanding as "ip addr
show" seems to give the sa
On 31Aug2013 14:17, Terry Reedy wrote:
| On 8/31/2013 2:13 PM, Terry Reedy wrote:
| >On 8/31/2013 1:11 PM, Eduardo Alvarez wrote:
| >>When using argparse, is there a way to specify in what order arguments
| >>get parsed?
| >
| >I expect argparse to forward iterate the sequence of arguments that it
On 08/31/2013 06:48 PM, Chris Angelico wrote:
> On Sun, Sep 1, 2013 at 9:44 AM, Anthony Papillion wrote:
>> I'm writing a processor for Bitmessage messages and I am needing to
>> parse the following returned JSON string:
>>
>> {u'inboxMessages':
>
> Does the JSON string really have those u prefix
On Sun, Sep 1, 2013 at 10:19 AM, Anthony Papillion wrote:
> On 08/31/2013 06:48 PM, Chris Angelico wrote:
>> On Sun, Sep 1, 2013 at 9:44 AM, Anthony Papillion
>> wrote:
>>> I'm writing a processor for Bitmessage messages and I am needing to
>>> parse the following returned JSON string:
>>>
>>> {
On 31Aug2013 19:19, Anthony Papillion wrote:
| On 08/31/2013 06:48 PM, Chris Angelico wrote:
| > On Sun, Sep 1, 2013 at 9:44 AM, Anthony Papillion
wrote:
| >> I'm writing a processor for Bitmessage messages and I am needing to
| >> parse the following returned JSON string:
| >>
| >> {u'inboxMess
On 08/31/2013 07:32 PM, Cameron Simpson wrote:
> On 31Aug2013 19:19, Anthony Papillion wrote:
> | On 08/31/2013 06:48 PM, Chris Angelico wrote:
> | > On Sun, Sep 1, 2013 at 9:44 AM, Anthony Papillion
> wrote:
> | >> I'm writing a processor for Bitmessage messages and I am needing to
> | >> parse
In article <5221352b$0$6599$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> Heh, everybody has one of two reactions:
>
> "This is awesome!" [[i.e. what I said]]
>
> "You'll add type checking to my Python code over my dead body!!!"
Duck typing is a funny thing. Sure, I don't ha
On 08/31/2013 07:32 PM, Chris Angelico wrote:
> On Sun, Sep 1, 2013 at 10:19 AM, Anthony Papillion
> wrote:
>> On 08/31/2013 06:48 PM, Chris Angelico wrote:
>>> On Sun, Sep 1, 2013 at 9:44 AM, Anthony Papillion
>>> wrote:
I'm writing a processor for Bitmessage messages and I am needing to
In article ,
anntzer@gmail.com wrote:
> Hi,
>
> At startup, IPython (qtconsole) calls
> "socket.gethostbyname_ex(socket.gethostname())[2]" to find a list of IP
> addresses that point to the machine. On a Linux server that I manage this
> call is extremely slow (>20s)... which I have troub
On Sat, 31 Aug 2013 18:44:04 -0500, Anthony Papillion wrote:
> Hello Everyone,
>
> I'm writing a processor for Bitmessage messages and I am needing to
> parse the following returned JSON string:
[...]
> For some reason (probably obvious reasons) isn't working. I'm trying to
> loop through the JSO
I've got a pandas DataFrame that looks like:
Int64Index: 12960 entries, 0 to 12959
Data columns (total 2 columns):
date12960 non-null values
ms 12960 non-null values
dtypes: datetime64[ns](1), float64(1)
date ms
12955 2013-08-30 23:20:00 96.868491
12956
On 30 Aug 2013 19:07, wrote:
>
> I'm starting a small project coding in Python as I learn the ropes. As
the project grows bigger, there are more and more overlapping and even
redundant methods. For example, several classes have a
checkAndClean_obj_state() method. If just one or two such classes, i
On Fri, 30 Aug 2013 11:04:28 -0700, niubao56 wrote:
> I'm starting a small project coding in Python as I learn the ropes. As
> the project grows bigger, there are more and more overlapping and even
> redundant methods. For example, several classes have a
> checkAndClean_obj_state() method. If just
It is the call to gethostbyname_ex that is very slow. The call to gethostname
is quick (and returns the same string as /usr/bin/hostname).
On Saturday, August 31, 2013 6:01:00 PM UTC-7, Roy Smith wrote:
> In article ,
>
> anntzer@gmail.com wrote:
>
>
>
> > Hi,
>
> >
>
> > At startup,
On 08/31/2013 10:51 PM, anntzer@gmail.com wrote:
> It is the call to gethostbyname_ex that is very slow. The call to
> gethostname is quick (and returns the same string as
> /usr/bin/hostname).
What gethostbyname_ex and /usr/bin/hostname do are very different
things. gethostbyname_ex does a
Eduardo Alvarez wrote:
> When using argparse, is there a way to specify in what order arguments
> get parsed? I am writing a script whose parameters can be modified in
> the following order:
>
> Defaults -> config file -> command-line switches.
>
> However, I want to give the option of specifyin
Τη Σάββατο, 31 Αυγούστου 2013 9:41:27 π.μ. UTC+3, ο χρήστης Ferrous Cranus
έγραψε:
> Suddenly my webiste superhost.gr running my main python script presents
>
> me with this error:
>
>
>
> Code:
>
> UnicodeDecodeError('utf-8', b'\xb6\xe3\xed\xf9\xf3\xf4\xef
>
> \xfc\xed\xef\xec\xe1 \xf3\xf
74 matches
Mail list logo