On Thu, 21 Jan 2016 07:52:17 -0700, Ian Kelly wrote:
>> I have no idea what was imported before. I just want to import
>> hexdump(). Unfortunately, this does not work:
>>
>> from utilities import hexdump
>>
>> ImportError: cannot import name hexdump
>
> What is utilities? Is it a module on
On Thu, 21 Jan 2016 15:31:45 +, John Gordon wrote:
> The most likely explanation here is that the 'utilities' module simply
> does not contain something named 'hexdump'.
>
> Have you inspected the 'utilities' module? Does it, in fact, contain
> something named 'hexdump'?
Yes
--
https://ma
On Thu, 21 Jan 2016 15:44:43 +, John Gordon wrote:
> How did this error come up? Did the code work previously? If so, what
> changed?
The developers of this legacy code had this as well as other functions
duplicated throughout the system, in order to avoid confronting these
issues. I'm tr
On Thu, 21 Jan 2016 15:44:43 +, John Gordon wrote:
> In that case, the problem is most likely a circular import issue, as you
> mentioned. The only way to fix it is to reorganize your modules.
>
> How did this error come up? Did the code work previously? If so, what
> changed?
What I nee
On Thu, 21 Jan 2016 08:59:39 -0700, Ian Kelly wrote:
> What happens if you just do 'import utilities'. Can you then call
> utilities.hexdump? Can you see anything in the utilities module?
Yes, that works! That's what I'm doing as a work around.
I was trying to avoid doing that because I figured
On Thu, 21 Jan 2016 16:30:30 +, Charles T. Smith wrote:
>> Side observation: 'int' is a bad name for a package, because it will
>> shadow the name of the 'int' built-in.
>
>
> Boy oh boy have I experienced that now! :)
(it wasn't me! ;)
On Fri, 22 Jan 2016 12:19:50 +0200, Marko Rauhamaa wrote:
> We need similar code sanity management. Developers are given much too
> much power to mess up the source code. That's why "legacy" is considered
> a four-letter word among developers.
When I started in this business, in the mid-70s, ther
Hi all,
The short version: How CPython marks a module as being fully imported, if it
does, so that the same import statement ran from another C thread at the same
time does not collide? Or, reversely, does not think the module is not already
fully imported?
The full version: I'm running CPytho
ted.
On Thursday, February 4, 2016 at 11:20:05 AM UTC+1, Jean-Charles Lefebvre wrote:
> Hi all,
>
> The short version: How CPython marks a module as being fully imported, if it
> does, so that the same import statement ran from another C thread at the same
> time does not co
When might a "global" statement be used in the outermost level of a module?
(whereby, I assume a module is equivalent to a python file, correct?)
TIA for any thoughts.
cts
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, 11 Mar 2016 19:29:20 +1100, Chris Angelico wrote:
> Usefully? Never.
>
> Simple question - simple answer :)
>
> ChrisA
Right, that was the expected answer as well. I just ran into that in
legacy code, checked out the documentation and couldn't really make that
out. So I figured I bet
On Fri, 11 Mar 2016 08:31:22 +, Mark Lawrence wrote:
> Never. Hopefully this
> http://www.python-course.eu/python3_global_vs_local_variables.php can
> explain it better than I can :)
The article is good, I'm glad to have confirmed what I have so empirical
stumbled over.
... Irrespective of t
>From the performance point of view, which is better:
- hasattr()
- x in y
TIA
cts
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, 11 Mar 2016 21:44:27 +, Charles T. Smith wrote:
> From the performance point of view, which is better: - hasattr()
> - x in y
>
> TIA
> cts
I just realized that "in" won't look back through the class hierarchy...
that clearly makes them not interc
On Fri, 11 Mar 2016 22:00:41 +, Grant Edwards wrote:
> Since they behave differently, perhaps the question ought to be "which
> does what you want to do?"
For parsed msgs, I had this:
elif hasattr (msg.msgBody, 'request'):
It occurred to me that this was less abstruse:
I've really learned to love working with python, but it's too soon
to pack perl away. I was amazed at how long a simple file search took
so I ran some statistics:
$ time python find-rel.py
./find-relreq *.out | sort -u
TestCase_F_00_P
TestCase_F_00_S
TestCase_F_01_S
TestCa
On Thu, 17 Mar 2016 18:34:06 +0200, Marko Rauhamaa wrote:
> n-vs-perl-performance
Okay, that was interesting.
Actually, I saw a study some years ago that concluded that python
could be both slower and faster than perl, but that perl had much
less deviation than python. I took that and accepted
On Thu, 17 Mar 2016 17:47:55 +0200, Marko Rauhamaa wrote:
> Can't comment on the numbers but the code segments are not quite
> analogous. What about this one:
>
> #!/usr/bin/env python
> # vim: tw=0
> import sys
> import re
>
> isready = re.compile("(.*) is ready")
> for
On Thu, 17 Mar 2016 09:21:51 -0700, Ethan Furman wrote:
>> well, I don't want to forgo REs in order to have python's numbers be
>> better
>
> The issue is not avoiding REs, but using Python's strengths and idioms.
> Write the code in Python's style, get the same results, then compare
> t
On Thu, 17 Mar 2016 17:48:54 +0200, Marko Rauhamaa wrote:
> "Charles T. Smith" :
>
>> On Thu, 17 Mar 2016 15:29:47 +, Charles T. Smith wrote:
>>
>> And for completeness, and also surprising:
>>
>> time sed -n -e '/ is ready
On Thu, 17 Mar 2016 18:07:12 +0200, Marko Rauhamaa wrote:
> "Charles T. Smith" :
> Ok. The LANG=C setting has a tremendous effect on the performance of
> textutils.
>
>
> Marko
Good to know, thank you...
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 17 Mar 2016 10:26:12 -0700, Ethan Furman wrote:
> On 03/17/2016 09:36 AM, Charles T. Smith wrote:
>
>> Yes, your point was to forgo REs despite that they are useful.
>> I could have thought the search would have been better as:
>>
>> 'release[
On Thu, 17 Mar 2016 18:30:29 +0200, Marko Rauhamaa wrote:
> "Charles T. Smith" :
>
>> I need the second check to also be a RE because it's not
>> separate tokens.
>
> The string "in" check doesn't care about tokens.
>
>
> Marko
On Thu, 17 Mar 2016 10:52:30 -0500, Tim Chase wrote:
>> Not saying this will make a great deal of difference, but these two
> items jumped out at me. I'd even be tempted to just use string
> manipulations for the isready aspect as well. Something like
> (untested)
well, I don't want to forgo RE
On Thu, 17 Mar 2016 19:08:58 +0200, Marko Rauhamaa wrote:
> "Charles T. Smith" :
>
>
> Compare Perl (http://www.perlmonks.org/?node_id=98357>):
>
>my $str = "I have a dream";
>my $find = "have";
>my $replace = "h
On Thu, 17 Mar 2016 15:29:47 +, Charles T. Smith wrote:
And for completeness, and also surprising:
time sed -n -e '/ is ready/{s///;h}' -e '/release_req/{g;p}' *.out | sort -u
TestCase_F_00_P
TestCase_F_00_S
TestCase_F_01_S
TestCase_F_02_M
real0m10.998s
u
On Thu, 17 Mar 2016 21:18:43 +0530, srinivas devaki wrote:
> please upload the log file,
Sorry, it's work stuff, can't do that, but just take any big set of files
and change the strings appropriately and the numbers should be equivalent.
>
> and global variables in python are slow, so just ke
Now, I'm getting these errors:
ImportError: cannot import name ...
and
AttributeError: 'module' object has no attribute ...
(what is 'module'?)
Is there a way to resolve this without having to restructure my code
every couple of days?
I thought using imports of the form:
from module i
On Sun, 16 Nov 2014 08:14:05 +0100, dieter wrote:
> "Charles T. Smith" writes:
>> Now, I'm getting these errors:
>>
>> ImportError: cannot import name ...
>>
>> and
>>
>> AttributeError: 'module' object has no attrib
On Mon, 17 Nov 2014 08:08:40 +0100, dieter wrote:
> "Charles T. Smith" writes:
>> ...
>> Are others equally frustrated by this or is there a trick or principle
>> that I'm missing. At this point, I guess the way I'll have to proceed
>> is to put e
On Tue, 18 Nov 2014 00:00:42 -0700, Michael Torrie wrote:
> On 11/17/2014 03:45 PM, Steven D'Aprano wrote:
>
>> Circular dependencies are not just a problem in Python, they are a
>> problem throughout most of software design.
>
> Personally I find that duck typing eliminates a lot of the circula
Hello,
I've been looking into using PyLint on some of my programs, just as a
best practices kind of thing.
Here's a snippet:
#==
if __name__ == '__main__':
parser = optparse.OptionParser(usage='usage: %prog [OPTIONS]')
pa
I'm sure I've read before about how to construct prototypes in Python,
but I haven't been able to track it down (or figure it out).
What I basically want is a kind of class that has both class and
instance level dict variables, such that descendant classes
automatically create their own class a
Gabriel Genellina wrote:
>> En Fri, 23 Feb 2007 17:53:59 -0300, Charles D Hixson
>> <[EMAIL PROTECTED]> escribió:
>>
>>
>>> I'm sure I've read before about how to construct prototypes in Python,
>>> but I haven't been able to track
Larry Bates wrote:
> Charles D Hixson wrote:
>
>> I'm sure I've read before about how to construct prototypes in Python,
>> but I haven't been able to track it down (or figure it out).
>>
>> What I basically want is a kind of class that has both cla
Toby wrote:
> Charles D Hixson wrote:
>
>> What I basically want is a kind of class that has both class and
>> instance level dict variables, such that descendant classes
>> automatically create their own class and instance level dict variables.
>> The id
Toby wrote:
> Charles D Hixson wrote:
>
>> a class whose sub-classes automatically have unique class variables of
>> a determined form such that I can do a hierarchical search through them
>>
>
> Something like this?
> (scroll down to see the results
I was reading through old messages in the list and came up against an
idea that I thought might be of some value:
"Wouldn't it be a good idea if one could "rewind" an iterator?"
Not stated in precisely those terms, perhaps, but that's the way I read it.
I appreciate that one could use a sequence r
I'm trying to construct read-only variables at the class level. I've
been unsuccessful. Any suggestions?
Mixing @classmethod and @property doesn't appear to produce workable
code. Ditto for mixing @classmethod and __getattr__. (The property
approach compiles, but execution says that you can
Arnaud Delobelle wrote:
> On Apr 12, 8:36 pm, Charles D Hixson <[EMAIL PROTECTED]>
> wrote:
>
>> I'm trying to construct read-only variables at the class level. I've
>> been unsuccessful. Any suggestions?
>>
>> Mixing @classmethod and @pr
Peter Otten wrote:
> Charles D Hixson wrote:
>
>
>> I want a hundred or so read-only variables, and I'm not sure the best
>> way to achieve it.
>>
>
> What do you really want to do? I recommend that you forget about bondage and
> rely upon displin
That was it ! What a stupid error...
Thank you !
--
Cp
On Wed, Feb 3, 2010 at 20:13, Jerry Hill wrote:
> On Wed, Feb 3, 2010 at 12:58 PM, Cpa wrote:
>> Sure.
>>
>> import sys,re,os
>> files2create = sys.argv[1:]
>> os.system('mkdir tmp')
>>
>> # Some code to create the .tex
>>
>> # Compile t
ternal libraries). Is there a way to put it in the global scope for
pdb to use? Also is there a way to automatically import it whenever
pdb starts up (like a matlab startup file)? (I'm not using ipython
as it's not happy with pdbtrack in emacs, so am launching from emacs M-
x pdb
db command).
>
> For debugging purposes it's OK to put your function into the __builtin__
> namespace:
>
>
>
> >>> def p(): print 42
> ...
> >>> import __builtin__
> >>> __builtin__.p = p
>
> Try it out:
>
> >>> with open("tmp.py", "w") as f:
>
> ... f.write("p()\n")
> ...>>> import tmp
>
> 42
Thanks very much for your help, Peter, that's exactly what I was
after :-)
Charles
--
http://mail.python.org/mailman/listinfo/python-list
there any other ways to do this?
thanks,
Charles
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 10, 3:43 pm, Jean-Paul Calderone
wrote:
> On Feb 10, 9:30 am, "Charles Fox (Sheffield)"
> wrote:
>
> > Hi guys,
> > I'm working on debugging a large python simulation which begins by
> > preloading a huge cache of data. I want to step through
On Feb 10, 6:22 pm, Jean-Paul Calderone
wrote:
> On Feb 10, 12:21 pm, "Charles Fox (Sheffield)"
> wrote:
>
>
>
> > On Feb 10, 3:43 pm, Jean-Paul Calderone
> > wrote:
>
> > > On Feb 10, 9:30 am, "Charles Fox (Sheffield)"
> > >
I'm stumped by this:
$ PYTHONPATH= python except
Traceback (most recent call last):
File "except", line 7, in
except getopt.error, msg:
AttributeError: 'module' object has no attribute 'error'
The program is:
$ cat except
#!/usr/bin/env python
import getopt
try:
opts, args = get
On Sun, 14 May 2017 15:30:52 +0200, Pavol Lisy wrote:
> On 5/14/17, Charles T. Smith wrote:
>> I'm stumped by this:
...
> Did you create getopt.py in your working directory? If so then try to
> rename it.
>
> PL.
That was it! Not in my working directory, but in th
301 - 349 of 349 matches
Mail list logo