On 2012-08-08 06:14, Ben Finney wrote:
Cameron Simpson writes:
All of you are saying "two names for the same module", and variations
thereof. And that is why the doco confuses.
I would expect less confusion if the above example were described as
_two_ modules, with the same source code.
That
Cameron Simpson writes:
> All of you are saying "two names for the same module", and variations
> thereof. And that is why the doco confuses.
>
> I would expect less confusion if the above example were described as
> _two_ modules, with the same source code.
That's not true though, is it? It's t
On Aug 8, 12:14 pm, Steven D'Aprano wrote:
> You claim that named Patterns simplify and clarify communication. If you
> have to look the terms up, they aren't simplifying and clarifying
> communication, they are obfuscating it.
By that argument, an encyclopaedia is useless because if you have to
On Wed, Aug 8, 2012 at 12:14 PM, Steven D'Aprano
wrote:
> NoneType raises an error if you try to create a second instance. bool
> just returns one of the two singletons (doubletons?) again.
>
> py> type(None)()
> Traceback (most recent call last):
> File "", line 1, in
> TypeError: cannot creat
On Tue, 07 Aug 2012 17:07:59 -0700, alex23 wrote:
>> I'm pretty sure that people could talk about good coding design before
>> the Gof4. As you say, they didn't invent the patterns. So people
>> obviously wrote code, and talked about algorithms, without the Gof4
>> terminology.
>
> So what did pe
Nobody於 2012年8月7日星期二UTC+8下午11時32分55秒寫道:
> On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote:
>
>
>
> >> for i in range(N,N+100):
>
> >> for j in range(M,M+100):
>
> >> do_something(i % 100 ,j % 100)
>
> >>
>
> >> Emile
>
> >
>
> > How about...
>
> >
>
On Aug 2, 2012, at 10:55 AM, Ethan Furman wrote:
> SQLite has a neat feature where if you give it a the file-name of ':memory:'
> the resulting table is in memory and not on disk. I thought it was a cool
> feature, but expanded it slightly: any name surrounded by colons results in
> an in-memo
On Aug 8, 5:02 am, Steven D'Aprano wrote:
> I haven't read the Gang of Four book itself, but I've spent plenty of
> time being perplexed by over-engineered, jargon-filled code, articles,
> posts and discussions by people who use Design Patterns as an end to
> themselves rather than a means to an e
In article ,
Cameron Simpson wrote:
> This, I think, is a core issue in this misunderstanding. (I got bitten
> by this too, maybe a year ago. My error, and I'm glad to have improved
> my understanding.)
>
> All of you are saying "two names for the same module", and variations
> thereof. And tha
On 07Aug2012 13:52, Steven D'Aprano
wrote:
| On Tue, 07 Aug 2012 09:18:26 -0400, Roy Smith wrote:
| > I thought modules could not get imported twice. The first time they get
| > imported, they're cached, and the second import just gets you a
| > reference to the original. Playing around, howeve
On 8/7/2012 3:02 PM, Steven D'Aprano wrote:
On Sun, 05 Aug 2012 19:44:31 -0700, alex23 wrote:
I think you've entirely missed the point of Design Patterns.
Perhaps I have. Or perhaps I'm just (over-)reacting to the abuse of
Patterns:
http://c2.com/cgi/wiki?DesignPatternsConsideredHarmful
or
On Wed, Aug 8, 2012 at 3:00 AM, lipska the kat wrote:
> I'm still undecided over the whole 'User' thing actually, I don't think I
> can see a time when I will have a User Class in one of my systems but as I
> don't want to get 'dogmatic' about this I remain open to any ideas that
> might include s
Hi,
I've just uploaded pypiserver 0.6.1 to the python package index.
pypiserver is a minimal PyPI compatible server. It can be used to serve
a set of packages and eggs to easy_install or pip.
pypiserver is easy to install (i.e. just easy_install pypiserver). It
doesn't have any external dependen
Steven D'Aprano於 2012年8月7日星期二UTC+8上午10時01分05秒寫道:
> On Mon, 06 Aug 2012 22:46:38 +0200, Mok-Kong Shen wrote:
>
>
>
> > If I have a string "abcd" then, with 8-bit encoding of each character,
>
> > there is a corresponding 32-bit binary integer. How could I best obtain
>
> > that integer and from
On Sun, 05 Aug 2012 19:44:31 -0700, alex23 wrote:
> I think you've entirely missed the point of Design Patterns.
Perhaps I have. Or perhaps I'm just (over-)reacting to the abuse of
Patterns:
http://c2.com/cgi/wiki?DesignPatternsConsideredHarmful
or maybe I'm just not convinced that Design Patt
Interesting stuff. Thanks.
On 08/06/2012 07:53 PM, alex23 wrote:
On Aug 4, 6:48 am, Tobiah wrote:
I have a bunch of classes from another library (the html helpers
from web2py). There are certain methods that I'd like to add to
every one of them. So I'd like to put those methods in a class,
On Tue, 07 Aug 2012 08:25:43 -0700, Roy Smith wrote:
> On Tuesday, August 7, 2012 9:52:59 AM UTC-4, Steven D'Aprano wrote:
>
>> In general, you should avoid non-idempotent code. You should doubly
>> avoid it during imports, and triply avoid it on days ending with Y.
You seem to have accidentally
On Tue, 07 Aug 2012 08:30:15 -0700, Thomas Draper wrote:
> I want to use with..as in a "reversible circuit generator". However, it
> seems that @contextmanager changes the expected nature of the class. I
> tried to distill the problem down to a simple example.
Nothing to do with contextmanager. T
On 8/7/2012 6:13 AM, Helmut Jarausch wrote:
I'd like to request adding the module
http://pypi.python.org/pypi/regex
to Python's standard library in the (near) future
As near as I can tell, the author is lukewarm about the prospect.
To respond the general question:
The author of a module shou
On 07/08/2012 14:18, Roy Smith wrote:
I've been tracking down some weird import problems we've been having with
django. Our settings.py file is getting imported twice. It has some
non-idempotent code in it, and we blow up on the second import.
I thought modules could not get imported twice. T
On 8/7/2012 11:32 AM, Roy Smith wrote:
On Tuesday, August 7, 2012 9:55:16 AM UTC-4, Ben Finney wrote:
The tutorial is misleading on this. It it says plainly:
A module can contain executable statements as well as function
definitions. […] They are executed only the *first* time the
module is im
On 07/08/2012 11:52, Helmut Jarausch wrote:> Hi Matthew,
>
> how to fix the code below to match 'Hellmuth' instead of ' Hellmut' ?
>
> A negative look behind in front of the pattern doesn't help since it
> counts
> as an error. One would need a means to mix a required match with a
> fuzzy match.
On 07/08/12 16:04, rusi wrote:
On Aug 7, 7:34 pm, lipska the kat wrote:
Never thought so for a moment, good to know you can be reasonable as
well as misguided ;-)
Well Lipska I must say that I find something resonant about the 'no-
person' thing, though I am not sure what.
You also said som
On 8/7/2012 9:28 AM, Ramchandra Apte wrote:
I don't think the modules are actually imported twice.
This is incorrect as Roy's original unposted example showed.
Modify one of the two copies and it will be more obvious.
PS. I agree with Mark about top posting. I often just glance as such
postin
On Aug 7, 2012 8:41 AM, "Roy Smith" wrote:
>
> On Tuesday, August 7, 2012 9:55:16 AM UTC-4, Ben Finney wrote:
>
> > The tutorial is misleading on this. It it says plainly:
> >
> > A module can contain executable statements as well as function
> > definitions. […] They are executed only th
Thomas Draper wrote:
> I want to use with..as in a "reversible circuit generator". However, it
> seems that @contextmanager changes the expected nature of the class. I
> tried to distill the problem down to a simple example.
>
> import contextlib
>
> class SymList:
The problem you experience ha
Roy Smith writes:
>> In general, you should avoid non-idempotent code.
> I don't understand your aversion to non-idempotent code as a general
> rule. Most code is non-idempotent. Surely you're not saying we
> should never write:
foo += 1
> or
my_list.pop()
> ???
I don't think "in gen
Given that "the customer is always right": In the past I've dealt with this
situation by creating one or more "query" classes and one or more edit classes.
I found it easier to separate these.
I would then create basic methods like EditStaff.add_empooyee(**kwargs) inside
of which I would drop
I want to use with..as in a "reversible circuit generator". However, it seems
that @contextmanager changes the expected nature of the class. I tried to
distill the problem down to a simple example.
import contextlib
class SymList:
def __init__(self, L=[]):
self.L = L
@contextli
On Tuesday, August 7, 2012 9:55:16 AM UTC-4, Ben Finney wrote:
> The tutorial is misleading on this. It it says plainly:
>
> A module can contain executable statements as well as function
> definitions. […] They are executed only the *first* time the module
> is imported somewhere.
>
On Tuesday, August 7, 2012 9:52:59 AM UTC-4, Steven D'Aprano wrote:
> In general, you should avoid non-idempotent code. You should
> doubly avoid it during imports, and triply avoid it on days ending with Y.
I don't understand your aversion to non-idempotent code as a general rule.
Most code i
On Mon, 06 Aug 2012 21:02:33 -0700, Larry Hudson wrote:
>> for i in range(N,N+100):
>> for j in range(M,M+100):
>> do_something(i % 100 ,j % 100)
>>
>> Emile
>
> How about...
>
> for i in range(100):
> for j in range(100):
> do_something((i + N) % 100,
Helmut Jarausch wrote:
> On Tue, 07 Aug 2012 13:15:29 +0200, Peter Otten wrote:
>
>> I don't think that will help. From PEP 408:
>>
>> """
>> As part of the same announcement, Guido explicitly accepted Matthew
>> Barnett's 'regex' module [4] as a provisional addition to the standard
>> library f
On Aug 7, 7:34 pm, lipska the kat wrote:
>
> Never thought so for a moment, good to know you can be reasonable as
> well as misguided ;-)
Well Lipska I must say that I find something resonant about the 'no-
person' thing, though I am not sure what.
You also said something about 'user' being more
On 07/08/2012 15:47, Helmut Jarausch wrote:
On Tue, 07 Aug 2012 13:15:29 +0200, Peter Otten wrote:
I don't think that will help. From PEP 408:
"""
As part of the same announcement, Guido explicitly accepted Matthew
Barnett's 'regex' module [4] as a provisional addition to the standard
library
On Tue, 07 Aug 2012 13:15:29 +0200, Peter Otten wrote:
> I don't think that will help. From PEP 408:
>
> """
> As part of the same announcement, Guido explicitly accepted Matthew
> Barnett's 'regex' module [4] as a provisional addition to the standard
> library for Python 3.3 (using the 'regex' n
On 2012-08-07 15:55, Ben Finney wrote:
Roy Smith writes:
So, it appears that you *can* import a module twice, if you refer to
it by different names! This is surprising.
The tutorial is misleading on this. It it says plainly:
A module can contain executable statements as well as function
On 07/08/12 15:14, Steven D'Aprano wrote:
On Tue, 07 Aug 2012 10:19:31 +0100, lipska the kat wrote:
On 07/08/12 06:19, Steven D'Aprano wrote:
[...]
But what *really* gets me is not the existence of poor terminology. I
couldn't care less what terminology Java programmers use among
themselves.
On Tue, 07 Aug 2012 10:19:31 +0100, lipska the kat wrote:
> On 07/08/12 06:19, Steven D'Aprano wrote:
[...]
>> But what *really* gets me is not the existence of poor terminology. I
>> couldn't care less what terminology Java programmers use among
>> themselves.
>
> I'd be most grateful if you cou
On 07/08/12 14:12, Ben Finney wrote:
lipska the kat writes:
The ONLY concept that you should never try to encapsulate is/are
human beings or their aliases.
You stated this in absolute, dogmatic terms. I thought at first you were
being hyperbolic for effect, but the situation that you present
On 07/08/2012 14:28, Ramchandra Apte wrote:
I don't think the modules are actually imported twice. The entry is just
doubled;that's all
Please don't top post, this is the third time of asking.
--
Cheers.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
On Monday, August 6, 2012 11:39:45 PM UTC-4, Dennis Lee Bieber wrote:
> On Tue, 7 Aug 2012 07:59:44 +1000, Chris Angelico
>
> declaimed the following in gmane.comp.python.general:
>
>
>
> > On Tue, Aug 7, 2012 at 5:22 AM, Dennis Lee Bieber
> > wrote:
>
> > > So am I beginner, intermediate,
On 07/08/2012 11:13, Helmut Jarausch wrote:
Hi,
I'd like to request adding the module
http://pypi.python.org/pypi/regex
to Python's standard library in the (near) future or to even replace the
current 're' module by it.
Personally I'm in need for fuzzy regular expressions and I don't see how
Roy Smith writes:
> So, it appears that you *can* import a module twice, if you refer to
> it by different names! This is surprising.
The tutorial is misleading on this. It it says plainly:
A module can contain executable statements as well as function
definitions. […] They are executed
On Tue, 07 Aug 2012 09:18:26 -0400, Roy Smith wrote:
> I thought modules could not get imported twice. The first time they get
> imported, they're cached, and the second import just gets you a
> reference to the original. Playing around, however, I see that it's
> possible to import a module twi
On Sat, 2012-08-04 at 20:26 -0700, shearich...@gmail.com wrote:
> >
> > Just out of curiosity, why do you eschew ORMs?
> Good question !
> I'm not anti-ORM (in fact in many circs I'm quite pro-ORM) but for
> some time I've been working with a client who doesn't want ORMs used
> (they do have quit
I don't think the modules are actually imported twice. The entry is just
doubled;that's all
On 7 August 2012 18:48, Roy Smith wrote:
> I've been tracking down some weird import problems we've been having with
> django. Our settings.py file is getting imported twice. It has some
> non-idempoten
I've been tracking down some weird import problems we've been having with
django. Our settings.py file is getting imported twice. It has some
non-idempotent code in it, and we blow up on the second import.
I thought modules could not get imported twice. The first time they get
imported, they
lipska the kat writes:
> The ONLY concept that you should never try to encapsulate is/are
> human beings or their aliases.
You stated this in absolute, dogmatic terms. I thought at first you were
being hyperbolic for effect, but the situation that you present to
support this dogma is o
On 07/08/12 12:21, S.B wrote:
Can anyone provide a simple code example of the client and server sides?
Working on it
lipska
--
Lipska the Kat: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun
--
http://mail.python.org/mailman/listinfo/python-list
You are correct.
On 7 August 2012 14:38, Chris Angelico wrote:
> On Tue, Aug 7, 2012 at 6:00 PM, Gelonida N wrote:
> > modulename = 'my.module'
> > cmd = 'import %s as amodule'
> > try:
> > exec(cmd)
> > print "imported successfully"
>
> Someone will doubtless correct me if I'm wrong, b
On Monday, August 6, 2012 4:32:13 PM UTC+3, S.B wrote:
> Hello friends
>
>
>
> Does anyone know if it's possible to pickle and un-pickle a file across a
> network socket. i.e:
>
> First host pickles a file object and writes the pickled file object to a
> client socket.
>
> Second host reads
Helmut Jarausch wrote:
> I'd like to request adding the module
>
> http://pypi.python.org/pypi/regex
>
> to Python's standard library in the (near) future or to even replace the
> current 're' module by it.
>
> Personally I'm in need for fuzzy regular expressions and I don't see how
> to do thi
On 07/08/12 10:44, Steven D'Aprano wrote:
On Mon, 06 Aug 2012 17:23:19 +0100, lipska the kat wrote:
On 06/08/12 13:19, rusi wrote:
I suggest this
http://steve-yegge.blogspot.in/2006/03/execution-in-kingdom-of-
nouns.html
http://bpfurtado.livejournal.com/2006/10/21/
Unfortunately the aut
Hi,
I'd like to request adding the module
http://pypi.python.org/pypi/regex
to Python's standard library in the (near) future or to even replace the
current 're' module by it.
Personally I'm in need for fuzzy regular expressions and I don't see how
to do this easily and efficiently without th
On Mon, 06 Aug 2012 17:23:19 +0100, lipska the kat wrote:
> On 06/08/12 13:19, rusi wrote:
>> I suggest this
>> http://steve-yegge.blogspot.in/2006/03/execution-in-kingdom-of-
nouns.html
>
> http://bpfurtado.livejournal.com/2006/10/21/
Unfortunately the author (Bruno Furtado) has missed the poi
On 07/08/12 06:19, Steven D'Aprano wrote:
On Mon, 06 Aug 2012 09:55:24 +0100, lipska the kat wrote:
On 06/08/12 01:22, Steven D'Aprano wrote:
On Sun, 05 Aug 2012 20:46:23 +0100, lipska the kat wrote:
[snip]
The clue is in the name 'Object Oriented' ... anything else is (or
should be) imp
On Tue, Aug 7, 2012 at 6:00 PM, Gelonida N wrote:
> modulename = 'my.module'
> cmd = 'import %s as amodule'
> try:
> exec(cmd)
> print "imported successfully"
Someone will doubtless correct me if I'm wrong, but I think you can
avoid exec here with:
amodule=__import__(modulename)
ChrisA
Gelonida N wrote:
> Is this possible.
>
> let's say I'd like to know whether I could import the module
> 'mypackage.mymodule', meaning,
> whther this module is located somewhere in sys.path
>
> i tried to use
>
> imp.find_module(), but
> it didn't find any module name containing a '.'
You coul
On 07/08/12 06:35, Steven D'Aprano wrote:
On Mon, 06 Aug 2012 10:24:10 +0100, lipska the kat wrote:
er, the point I was trying to make is that when you say 'interface' it
could mean so many things. If you say 'facade' everyone knows exactly
what you are talking about. And that is EXACTLY the po
Hi Michael,
On 08/07/2012 08:43 AM, Michael Poeltl wrote:
in my opinion, "without importing it" makes it unnecessarily complicated.
It does, but I think this is what I want, thus my question.
I tried to keep my question simple without explaining too much.
Well now here's a little more context
On 07/08/2012 02:12, Steven D'Aprano wrote:
On Mon, 06 Aug 2012 17:17:33 +0100, Mark Lawrence wrote:
Please see my comment at the bottom hint hint :)
Please trim unnecessary quoted text.
We don't need to see the entire thread of comment/reply/reply-to-reply
duplicated in *every* email.
P
Not back to 2.5, but they're not that important anyway. Just use:
d = dict((k, v) for k,v in ... )
Thank you very much! It is the perfect solution for me.
Regards,
Iryna.
--
http://mail.python.org/mailman/listinfo/python-list
Iryna Feuerstein writes:
> code. The dictionary comprehensions were added to Python in version
> 2.7 at first time. Is it possible to make it compatible with Python
> 2.5 anyway? Perhaps by using the __future__ module?
Not back to 2.5, but they're not that important anyway. Just use:
d = dict
64 matches
Mail list logo