On Mon, Nov 28, 2011 at 7:42 PM, Travis Parks wrote:
> I find that interesting. I also find it interesting that the common
> functional methods (all, any, map, filter) are basically built into
> Python core language. That is unusual for most imperative programming
> languages early-on.
all and an
On Nov 29, 5:22 am, Den wrote:
> On Nov 26, 3:01 pm, Steven D'Aprano > That is correct. You probably should rarely use `is`. Apart from testing
> > for None, use of `is` should be rare.
>
> With respect, I disagree with advice that the use of a language
> construct should be rare. All constructs
On 11/28/2011 03:08 PM, Terry Reedy wrote:
On 11/28/2011 6:45 AM, Andrea Crotti wrote:
I'm happily using the ast module to analyze some code,
but my scripts need also to run unfortunately on python 2.5
The _ast was there already, but the ast helpers not yet.
Is it ok if I just copy over the sou
On 11/28/2011 03:03 PM, Alan Meyer wrote:
On 11/24/2011 9:27 AM, Dave Angel wrote:
...
Several ways to speed up code.
1) use language features to best advantage
2) use 3rd party libraries that do certain things well
3) use best algorithms, subject to #1 and #2
4) have someone else review the co
On Nov 28, 5:57 pm, Steven D'Aprano wrote:
> On Mon, 28 Nov 2011 13:29:06 -0800, Travis Parks wrote:
> > Exception handling is one of those subjects few understand and fewer can
> > implement properly in modern code. Languages that don't support
> > exceptions as part of their signature lead to ca
On Nov 28, 8:49 pm, Chris Angelico wrote:
> On Tue, Nov 29, 2011 at 11:54 AM, DevPlayer wrote:
> > To me, I would think the interpreter finding the coder's intended
> > indent wouldn't be that hard. And just make the need for consistant
> > spaces or tabs irrevelent simply by reformatting the ind
On Tue, Nov 29, 2011 at 1:42 PM, Travis Parks wrote:
> A good example I have run into is recursion. When a local function
> calls itself, the name of the function may not be part of scope (non-
> local). Languages that support tail-end recursion optimization can't
> optimize. In order to support t
On Nov 28, 5:24 pm, Steven D'Aprano wrote:
> On Mon, 28 Nov 2011 12:32:59 -0700, Ian Kelly wrote:
> > On Sun, Nov 27, 2011 at 4:55 PM, Steven D'Aprano
> > wrote:
> [...]
> >>> Lambdas and functions are the same thing in my language, so no need
> >>> for a special keyword.
>
> >> That does not fol
On Tue, Nov 29, 2011 at 11:54 AM, DevPlayer wrote:
> To me, I would think the interpreter finding the coder's intended
> indent wouldn't be that hard. And just make the need for consistant
> spaces or tabs irrevelent simply by reformatting the indent as
> expected. Pretty much all my text editors
> I do not understand why the interpreter preprocesses each logical line
> of source code using something as simple as this:
correction:
I do not understand why the interpreter - does not- preprocess each
logical line
of source code using something as simple as this:
--
http://mail.python.org/m
On Nov 27, 6:55 pm, Steven D'Aprano wrote:
> On Sun, 27 Nov 2011 14:21:01 -0800, Travis Parks wrote:
> > Personally, I find a lot of good things in Python. I thinking tabs are
> > out-of-date. Even the MAKE community wishes that the need for tabs would
> > go away and many implementations have don
On Mon, 28 Nov 2011 13:29:06 -0800, Travis Parks wrote:
> Exception handling is one of those subjects few understand and fewer can
> implement properly in modern code. Languages that don't support
> exceptions as part of their signature lead to capturing generic
> Exception all throughout code. It
On Tue, Nov 29, 2011 at 9:24 AM, Steven D'Aprano
wrote:
> Because the syntax is completely different. One is a statement, and
> stands alone, the other is an expression. Even putting aside the fact
> that lambda's body is an expression, and a def's body is a block, def
> also requires a name. Usin
On Mon, 28 Nov 2011 12:32:59 -0700, Ian Kelly wrote:
> On Sun, Nov 27, 2011 at 4:55 PM, Steven D'Aprano
> wrote:
[...]
>>> Lambdas and functions are the same thing in my language, so no need
>>> for a special keyword.
>>
>> That does not follow. Lambdas and def functions are the same thing in
>>
On Tue, Nov 29, 2011 at 8:29 AM, Travis Parks wrote:
> Languages that don't support
> exceptions as part of their signature lead to capturing generic
> Exception all throughout code. It is one of those features I wish .NET
> had. At the same time, with my limited experience with Java, it has
> bee
Jean-Michel Pichavant wrote:
PS : Try to code & document in English, it's much better especially
when asking for help on this list, mixing spanish and english has few
benefits since you may bother both spanish and english ppl :o)
Actually it is english mixed with portuguese, sorry if I offende
On Nov 28, 3:40 pm, Gregory Ewing wrote:
> Travis Parks wrote:
> > I thinking tabs are
> > out-of-date. Even the MAKE community wishes that the need for tabs
> > would go away
>
> The situation with make is a bit different, because it
> *requires* tabs in certain places -- spaces won't do.
> Pytho
On Nov 28, 2:32 pm, Ian Kelly wrote:
> On Sun, Nov 27, 2011 at 4:55 PM, Steven D'Aprano
>
> wrote:
> >> My language combines generators and collection initializers, instead of
> >> creating a whole new syntax for comprehensions.
>
> >> [| for i in 0..10: for j in 0.10: yield return i * j |]
>
> >
On 2011-11-28, Gregory Ewing wrote:
> Neil Cerutti wrote:
>> I've always held with the "anti-functional style conspiracy"
>> interpretation of Python's lambda expressions. They were added
>> but grudgingingly, made weak on purpose to discourage their
>> use.
>
> Seems to me that Python's lambdas a
Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
On 28 November 2011 20:45, Ethan Furman wrote:
> plsulliv...@gmail.com wrote:
>>
>> s = GIS.GIS.Cadastral\GIS.GIS.Citylimit
>> NeededValue = Citylimit
>
> NeededValue = s.rsplit('.', 1)[1]
Also:
>>> s[s.rfind(".") + 1:]
'Citylimit'
>>> s.rpartition(".")[2]
'Citylimit'
--
Arnaud
--
http://mail
plsulliv...@gmail.com wrote:
s = GIS.GIS.Cadastral\GIS.GIS.Citylimit
NeededValue = Citylimit
NeededValue = s.rsplit('.', 1)[1]
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
Hello all,
My python runs and crashes after another run. I am getting errors like
Microsoft Visual C++ Runtime Library
program c:\Python27\pythonw.exe
This application has requested the Runtime to terminate it in an usuak way.
Please contact the application's support team for more information.
Neil Cerutti wrote:
I've always held with the "anti-functional style conspiracy"
interpretation of Python's lambda expressions. They were added
but grudgingingly, made weak on purpose to discourage their use.
Seems to me that Python's lambdas are about as powerful
as they can be given the stat
Travis Parks wrote:
I thinking tabs are
out-of-date. Even the MAKE community wishes that the need for tabs
would go away
The situation with make is a bit different, because it
*requires* tabs in certain places -- spaces won't do.
Python lets you choose which to use as long as you don't
mix them
Den wrote:
With respect, I disagree with advice that the use of a language
construct should be rare. All constructs should be used
*appropriately*.
+1
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list
I need for GIS.GIS.Cadastral\GIS.GIS.Citylimit to be Citylimit. The "cadastral"
and "citylimit" will be different as I readlines from a list. In other words,
the above could be GIS.GIS.Restricted\GIS.GIS.Pipeline and I would need
Pipeline.
s = GIS.GIS.Cadastral\GIS.GIS.Citylimit
NeededValue = C
On 2011-11-28, Ian Kelly wrote:
> I think the implication is that Unit has only one syntax for
> creating functions, which is lambda-style. In any case, why
> does Python require a special keyword? def is only used in a
> statement context, and lambda is only used in an expression
> context. Wh
On 11/28/2011 6:45 AM, Andrea Crotti wrote:
I'm happily using the ast module to analyze some code,
but my scripts need also to run unfortunately on python 2.5
The _ast was there already, but the ast helpers not yet.
Is it ok if I just copy over the source from the ast helpers in my code
base
T
On 11/24/2011 9:27 AM, Dave Angel wrote:
...
Several ways to speed up code.
1) use language features to best advantage
2) use 3rd party libraries that do certain things well
3) use best algorithms, subject to #1 and #2
4) have someone else review the code (perhaps on the list, perhaps
within you
On Nov 26, 3:01 pm, Steven D'Aprano wrote:
> On Sat, 26 Nov 2011 22:20:36 +0100, candide wrote:
>>SNIP<<
>
> That is correct. You probably should rarely use `is`. Apart from testing
> for None, use of `is` should be rare.
>
> --
> Steven
With respect, I disagree with advice that the use of a lang
On Sun, Nov 27, 2011 at 4:55 PM, Steven D'Aprano
wrote:
>> My language combines generators and collection initializers, instead of
>> creating a whole new syntax for comprehensions.
>>
>> [| for i in 0..10: for j in 0.10: yield return i * j |]
>
> Are we supposed to intuit what that means?
>
> Is
On Nov 25, 2:13 am, Noah Hall wrote:
> On Fri, Nov 25, 2011 at 5:08 AM, Matt Joiner wrote:
> > I haven't heard of you before, but feel like I've missed out on something.
>
> > Do you (or someone else) care to link to some of your more contentious work?
>
> Ignore him, he's a troll with an unjustl
thanks everyone. I thought blarg.next() looked a little strange--I'm just
learning generators now and I'm glad too see that next(blarg) is the way to go.
The example really was just a toy or I would use an iterator. I do need the two
(well, the several) generators to not be coupled together so t
On Nov 27, 6:55 pm, Steven D'Aprano wrote:
> On Sun, 27 Nov 2011 14:21:01 -0800, Travis Parks wrote:
> > Personally, I find a lot of good things in Python. I thinking tabs are
> > out-of-date. Even the MAKE community wishes that the need for tabs would
> > go away and many implementations have don
Adam Funk, 25.11.2011 14:50:
I'm converting JSON data to XML using the standard library's json and
xml.dom.minidom modules. I get the input this way:
input_source = codecs.open(input_file, 'rb', encoding='UTF-8', errors='replace')
It doesn't make sense to use codecs.open() with a "b" mode.
On 2011-11-28, Peter Otten <__pete...@web.de> wrote:
> Eduardo Alvarez wrote:
>
>> however, if I do the following:
>>
>> b = mailbox.Maildir("~/Maildir")
>> b.items()
>>
>> I get an empty list.
>>
>> I don't understand why this is so, specially since the last example in
>> the documentation show
Tim wrote:
> Hi, I need to generate a list of file names that increment, like
this:
> fname1
> fname2
> fname3 and so on.
>
> I don't know how many I'll need until runtime so I figure a
generator is
> called for.
>
> def fname_gen(stem):
> i = 0
> while True:
> i = i+1
>
Eduardo Alvarez wrote:
> however, if I do the following:
>
> b = mailbox.Maildir("~/Maildir")
> b.items()
>
> I get an empty list.
>
> I don't understand why this is so, specially since the last example in
> the documentation shows a reference to a Maildir object being created.
> Why does this
On Tue, Nov 29, 2011 at 4:21 AM, Eduardo Alvarez
wrote:
> if I call a Maildir object directly, the module works perfectly. I can,
> for example, call
>
> mailbox.Maildir("~/Maildir").items()
>
> and get the expected list of (key,Message) pairs.
>
> however, if I do the following:
>
> b = mailbox.M
Hello, everyone,
I'm in the process of learning how to use the mailbox module with python
3.2. I've noticed the following seemingly inconsistent behavior:
if I call a Maildir object directly, the module works perfectly. I can,
for example, call
mailbox.Maildir("~/Maildir").items()
and get the e
On 2011-11-28, Steven D'Aprano
wrote:
> On Mon, 28 Nov 2011 07:36:17 -0800, Tim wrote:
>> Hi, I need to generate a list of file names that increment, like this:
>> fname1
>> fname2
>> fname3 and so on.
>>
>> I don't know how many I'll need until runtime so I figure a
>> generator is called for.
>
Tim wrote:
> Hi, I need to generate a list of file names that increment, like this:
> fname1
> fname2
> fname3 and so on.
>
> I don't know how many I'll need until runtime so I figure a generator is
> called for.
>
> def fname_gen(stem):
> i = 0
> while True:
> i = i+1
>
On Mon, 28 Nov 2011 07:36:17 -0800, Tim wrote:
> Hi, I need to generate a list of file names that increment, like this:
> fname1
> fname2
> fname3 and so on.
>
> I don't know how many I'll need until runtime so I figure a generator is
> called for.
>
> def fname_gen(stem):
> i = 0
> whil
Thanks Chris and JM, I will explore how much work it's going to take
to change the various scripts to _always_ starting the logger from
main().
As further explanation - this code predates the logging module, and
many of the functions/classes had an optional argument for the home-
made
logger - and
Hi, I need to generate a list of file names that increment, like this:
fname1
fname2
fname3 and so on.
I don't know how many I'll need until runtime so I figure a generator is called
for.
def fname_gen(stem):
i = 0
while True:
i = i+1
yield '%s%d' % (stem,i)
blarg = fnam
In article ,
Jean-Michel Pichavant wrote:
> Loggers are static objects managed by the module itself.
For reasons I can't quite explain, that sentence makes me want to sing
The Lumberjack Song. "I'm a logger(*) and I'm OK..."
(*) Yes, I know that's not right.
--
http://mail.python.org/mailma
On 2011-11-28 14:14, rusi wrote:
On Nov 28, 4:42 pm, Steven D'Aprano wrote:
We don't chase people down on the street and lecture them about the
problems we think they are having, we answer questions about ACTUAL
problems that they have experienced and asking about.
... ever question gets
On Mon, 28 Nov 2011 05:14:27 -0800, rusi wrote:
> On Nov 28, 4:42 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote:
>> We don't chase people down on the street and lecture them about the
>> problems we think they are having, we answer questions about ACTUAL
>> problems that they have ex
cassiope wrote:
I've been trying to migrate some code to using the standard python
logging classes/objects. And they seem quite capable of doing what I
need them to do. Unfortunately there's a problem in my unit tests.
It's fairly common to have to create quite a few entities in the
course of a
Jayron Soares wrote:
Hi Felipe,
I did, however I got this error:
Traceback (most recent call last):
File "/home/jayron/Downloads/grafos.py", line 48, in
g, e = ministro_lei()
File "/home/jayron/Downloads/grafos.py", line 34, in ministro_lei
for i in G.degree():
TypeError: 'int' obj
On Nov 28, 4:42 pm, Steven D'Aprano wrote:
> We don't chase people down on the street and lecture them about the
> problems we think they are having, we answer questions about ACTUAL
> problems that they have experienced and asking about.
> ... ever question gets an answer, and we're discussing
>
candide wrote:
In which cases should we use the is() function ? The is() function
compares identity of objects rather than values so I was wondering in
which circumstances comparing identities of objects is really vital.
Examining well reputated Python source code, I realize that is()
functio
Hi Felipe,
I did, however I got this error:
Traceback (most recent call last):
File "/home/jayron/Downloads/grafos.py", line 48, in
g, e = ministro_lei()
File "/home/jayron/Downloads/grafos.py", line 34, in ministro_lei
for i in G.degree():
TypeError: 'int' object is not iterable
I
On 11/28/11 12:12 PM, Tim Chase wrote:
Are there best-practices for creating wizards or asking various questions
(whether yes/no or text/numeric entry) in a cmd.Cmd class? Something like the
imaginary confirm() and get_string() methods here:
class MyCmd(cmd.Cmd):
def do_name(self,line):
s = get_
On Fri, 25 Nov 2011 13:50:01 +, Adam Funk wrote:
> I'm converting JSON data to XML using the standard library's json and
> xml.dom.minidom modules. I get the input this way:
>
> input_source = codecs.open(input_file, 'rb', encoding='UTF-8',
> errors='replace') big_json = json.load(input_sour
Are there best-practices for creating wizards or asking various
questions (whether yes/no or text/numeric entry) in a cmd.Cmd
class? Something like the imaginary confirm() and get_string()
methods here:
class MyCmd(cmd.Cmd):
def do_name(self,line):
s = get_string(prompt=line, defa
Hi Jayron,
Instead of using "Q" to loop over the result, use: "dbcursor".
resp = dbcursor.fetchall()
I hope it helps.
Regards,
Felipe.
On Mon, Nov 28, 2011 at 9:54 AM, Jayron Soares wrote:
> Hi guys!
>
> I'm stuck at a problem, when I run the follow code:
>
> http://pastebin.com/4Gd9V325
>
>
Hi guys!
I'm stuck at a problem, when I run the follow code:
http://pastebin.com/4Gd9V325
I get this error:
Traceback (most recent call last):
File "/home/jayron/Downloads/grafos.py", line 49, in
g, e = ministro_lei()
File "/home/jayron/Downloads/grafos.py", line 24, in ministro_lei
I'm happily using the ast module to analyze some code,
but my scripts need also to run unfortunately on python 2.5
The _ast was there already, but the ast helpers not yet.
Is it ok if I just copy over the source from the ast helpers in my code base
or is there a smarter way?
(I don't even need al
On Sun, 27 Nov 2011 23:18:15 -0800, rusi wrote:
> On Nov 28, 9:37 am, alex23 wrote:
>
>> With that approach in mind, I've never had any real issues using pip,
>> virtualenv etc for managing my development environment.
>
> Yes that is in a way my point also: we discuss (things like) pip,
> virtu
Thanks Stefan,
On 11/28/2011 08:38 AM, Stefan Behnel wrote:
> Gelonida N, 27.11.2011 18:57:
>> I'd like to verify some (x)html / / html5 / xml documents from a server.
>>
>> These documents have a very limited number of different doc types / DTDs.
>>
>> So what I would like to do is to build a sm
On Sunday, November 27, 2011 4:49:14 PM UTC+8, 8 Dihedral wrote:
> On Sunday, November 27, 2011 4:29:52 PM UTC+8, 8 Dihedral wrote:
> > On Sunday, November 27, 2011 12:03:26 PM UTC+8, Matt Joiner wrote:
> > > Sounds like you want a key-value store. If it's a lot of data, you may
> > > still
On 28/11/2011 04:16, cassiope wrote:
I've been trying to migrate some code to using the standard python
logging classes/objects. And they seem quite capable of doing what I
need them to do. Unfortunately there's a problem in my unit tests.
It's fairly common to have to create quite a few entiti
64 matches
Mail list logo