I got it! Thank you.
Hope in one day I could help other newbies as you do.
--
https://mail.python.org/mailman/listinfo/python-list
On Saturday, July 23, 2016 at 9:49:51 AM UTC+8, Steven D'Aprano wrote:
> Because it cannot tell the difference between an empty code block and
> failing to indent the code block:
>
> for x in sequence:
> print('loop')
Thanks for the excellent answer!
--
https://mail.python.org/mailman/listinfo/
On Sat, 23 Jul 2016 01:33 am, Kent Tong wrote:
> Hi
>
> I'm aware that we can use 'pass' as an empty code block. But why doesn't
> python allow a code block to be empty and thus eliminate the need for this
> null statement?
Because it cannot tell the difference between an empty code block and
fa
On Sat, 23 Jul 2016 01:21 am, justin walters wrote:
> That should illustrate why. This is because simply typing '{}' could be
> interpreted as
> either a dict or a set.
No. {} is always an empty dict. That is a language guarantee. Any
programming language where {} is not an empty disk is not val
I'm developing a web app based on aiohttp, and I find the event loop
concept very interesting. I never programmed with it before, but I
know that node.js and GUIs are based on it.
What I can't understand is how asyncio make it possible to run
multiple tasks concurrently, since it's single threaded
Hi Michael,
> Out[3]: 'HELLO'
> In [4]: g = str.upper
> In [5]: g(s)
> Out[5]: 'HELLO'
That's perfect! My mistake was trying to use the method returned by
''.upper vs. str.upper.
Thank you,
Malcolm
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Jul 22, 2016 at 4:05 PM Malcolm Greene wrote:
> I know I can do the following:
>
> >>> s = 'lower'
> >>> getattr(s, 'upper')()
> 'LOWER'
>
> But how could I do the same if I had the method 'address' (better
> name???) vs. method name?
>
> >>> upper_method = s.upper
>
> How do I combine th
I know I can do the following:
>>> s = 'lower'
>>> getattr(s, 'upper')()
'LOWER'
But how could I do the same if I had the method 'address' (better
name???) vs. method name?
>>> upper_method = s.upper
How do I combine this upper_method with string s to execute the method
and return 'LOWER'?
On Fri, Jul 22, 2016 at 2:11 AM Steven D'Aprano wrote:
> On Fri, 22 Jul 2016 03:18 pm, Michael Selik wrote:
> >> On Jul 22, 2016, at 12:39 AM, Jordan Bayless
> wrote:
> >>
> >> Posting the entire code snippet is tough because it's thousands of lines
> >> of code.
> >
> > You could paste into a G
On 2016-07-22 16:41, D'Arcy J.M. Cain wrote:
On Fri, 22 Jul 2016 08:21:17 -0700
justin walters wrote:
You could also replace that line with:
if stock is None or type(stock) != dict:
Use isinstance(). That handles classes that subclass dict as well.
If you're checking that it's a dict,
On Fri, 22 Jul 2016 08:21:17 -0700
justin walters wrote:
> You could also replace that line with:
>
> if stock is None or type(stock) != dict:
Use isinstance(). That handles classes that subclass dict as well.
--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@
Hi Tim,
> I think that what you're looking for is a topological sort
BINGO! That's *exactly* what I was searching for.
Thank you very much,
Malcolm
--
https://mail.python.org/mailman/listinfo/python-list
Kent Tong wrote:
> Hi
>
> I'm aware that we can use 'pass' as an empty code block. But why doesn't
> python allow a code block to be empty and thus eliminate the need for this
> null statement?
>
> thanks in advance
Because it's more likely that you have an indentation error than an
intentional
On 22/07/2016 17:01, Malcolm Greene wrote:
We're working on a DSL (domain specific language) that we translate into
a list of tokenized expressions. My challenge is to figure out how to
sequence evaluation of these expressions so that we evaluate these
expressions in the proper order given that e
Chris Kaynor writes:
> On Thu, Jul 21, 2016 at 4:54 PM, Ben Bacarisse wrote:
>
>> Steven D'Aprano writes:
>>
>> > Or you might be using a language like Javascript, which intentionally has
>> > only floats for numbers. That's okay, you can still perform exact integer
>> > arithmetic, so long as
We're working on a DSL (domain specific language) that we translate into
a list of tokenized expressions. My challenge is to figure out how to
sequence evaluation of these expressions so that we evaluate these
expressions in the proper order given that expressions have dependencies
on other express
Jordan Bayless wrote:
>
> desired = Id < 10 or Id > 133 or Id in good_ids
>
> When I try to validate whether I passed that check,
> I'm told there's a Name error and it's not defined
>
On the outside chance that failing to define Id
produces the Name error, I defined Id in a fo
On Fri, Jul 22, 2016, at 11:21, justin walters wrote:
> Try opening the interactive terminal on your command line and type the
> following:
>
> type({}) == dict()
>
> That should illustrate why.
That doesn't illustrate anything relevant at all. The reason this is
false is because dict() is
On Sat, Jul 23, 2016 at 1:21 AM, justin walters
wrote:
> Hi Chris,
>
> Try opening the interactive terminal on your command line and type the
> following:
>
> type({}) == dict()
>
> That should illustrate why. This is because simply typing '{}' could be
> interpreted as
> either a dict or a se
Hi
I'm aware that we can use 'pass' as an empty code block. But why doesn't python
allow a code block to be empty and thus eliminate the need for this null
statement?
thanks in advance
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, Jul 22, 2016 at 6:24 AM, Chris Angelico wrote:
> On Fri, Jul 22, 2016 at 11:13 PM, Dennis Lee Bieber
> wrote:
> > Now... Going much beyond the assignment (if you were having
> trouble
> > with the assignment, this will seem like magic) [Python 2.7]:
>
> I'm not sure, but I think
On 2016-07-22 14:59, Zagyen Leo wrote:
yeah, it may be quite simple to you experts, but hard to me.
In one of exercises from the Tutorial it said: "Write a program that asks the user their name, if they enter your name
say "That is a nice name", if they enter "John Cleese" or "Michael Palin", t
:
On Jul 22, 2016 7:46 AM, "Gordon Levi" wrote:
>
> Zagyen Leo wrote:
>
> >yeah, it may be quite simple to you experts, but hard to me.
> >
> >In one of exercises from the Tutorial it said: "Write a program that
asks the user their name, if they enter your name say "That is a nice
name", if they
On 2016-07-22 05:19, Jordan Bayless wrote:
I'm trying to modify some code to suit my purposes and I'm just trying to
filter results as necessary. Basically, the code is returning one of a number
from a subset of 150 numbers. I want to only do anything with it if the number
is a 'good' one. I'm
On 2016-07-22 07:01, Tian JiaLin wrote:
HI There,
I'm using MySQLdb as the MySQL client. Recently I got a weird problem of this
library. After looking into it, I suspect the problem may related to the
conversion from unsigned long to PyLongObject.
Here is the detail, If you are familiar with
Zagyen Leo wrote:
>yeah, it may be quite simple to you experts, but hard to me.
>
>In one of exercises from the Tutorial it said: "Write a program that asks the
>user their name, if they enter your name say "That is a nice name", if they
>enter "John Cleese" or "Michael Palin", tell them how yo
On Jul 22, 2016 10:00 AM, "Zagyen Leo" wrote:
>
> yeah, it may be quite simple to you experts, but hard to me.
>
> In one of exercises from the Tutorial it said: "Write a program that asks
the user their name, if they enter your name say "That is a nice name", if
they enter "John Cleese" or "Micha
On Fri, Jul 22, 2016, at 09:59, Zagyen Leo wrote:
> yeah, it may be quite simple to you experts, but hard to me.
>
> In one of exercises from the Tutorial it said: "Write a program that asks
> the user their name, if they enter your name say "That is a nice name",
> if they enter "John Cleese" o
yeah, it may be quite simple to you experts, but hard to me.
In one of exercises from the Tutorial it said: "Write a program that asks the
user their name, if they enter your name say "That is a nice name", if they
enter "John Cleese" or "Michael Palin", tell them how you feel about them ;),
ot
On Fri, Jul 22, 2016 at 11:13 PM, Dennis Lee Bieber
wrote:
> Now... Going much beyond the assignment (if you were having trouble
> with the assignment, this will seem like magic) [Python 2.7]:
I'm not sure, but I think your code would become Py3 compatible if you
just change your prints.
I'm certainly not going to sugar-coat it and act like I know anything about
this language, or wax about how I think it's "inferior" for any reason (because
doing so would be pretty foolish). I just figured I'd be able to muddle through
and find *something* that would easily filter out results I
On Fri, 22 Jul 2016 06:52 pm, Yubin Ruan wrote:
> Hi,
> I'm migrating my code to python3 now and find it hard to deal with
> python's 'str' and 'bytes' type. It's kind of painful. One thing I
> find really confusing is that, writing to a socket requires argument
> to be of type 'by
"Yubin Ruan" wrote in message
news:47f3acf9-8da2-4aad-a6f0-7a9efbdfe...@googlegroups.com...
In my understanding, writing to a file would requires that everything be
written byte by byte. So writing objects of type 'bytes' to socket makes
sense. But, how could python write to file using unic
On Fri, Jul 22, 2016 at 6:52 PM, Yubin Ruan wrote:
> In my understanding, writing to a file would requires that everything be
> written byte by byte. So writing objects of type 'bytes' to socket makes
> sense. But, how could python write to file using unicode(type 'str')? Does
> python enco
Hi,
I'm migrating my code to python3 now and find it hard to deal with python's
'str' and 'bytes' type. It's kind of painful.
One thing I find really confusing is that, writing to a socket requires
argument to be of type 'bytes'(otherwise python throw 'str does not support
buffer interfa
35 matches
Mail list logo