Garrett Berg writes:
> I made the switch to python 3 about two months ago, and I have to say
> I love everything about it, *especially* the change to using only
> bytes and str (no more unicode! or... everything is unicode!) As
> someone who works with embedded devices, it is great to know what d
I made the switch to python 3 about two months ago, and I have to say I
love everything about it, *especially* the change to using only bytes and
str (no more unicode! or... everything is unicode!) As someone who works
with embedded devices, it is great to know what data I am working with.
However
"Charles T. Smith" writes:
> 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 t
Apologies for previous code example. Yes, the 'def class' should read: 'class'.
Writing a sample to better demonstrate the issue made me realize that super()
is doing something special. It is injecting the magic '__class__' local.
I should rephrase my question: How do I get the declaring class
On Sun, Nov 16, 2014 at 4:25 PM, wrote:
> When super().__init__() is called, a 'magic' local appears in frame.f_locals
> called '__class__'. Helpfully, it has the correct class for the context,
> which will differ from type(self). (I discovered this magic local by poking
> around in the debu
On Sun, Nov 16, 2014 at 4:25 PM, Dan Stromberg wrote:
> Works for me, although it's a little different in Jython:
> $ pythons --command 'import sys; print(sys.stdin.fileno())'
> /usr/local/jython-2.7b3/bin/jython good org.python.core.io.StreamIO@170ed6ab
Huh, that is curious. According to its CPy
Hello,
I am CPython 3.4+ user on Linux.
I am writing a little library for myself to improve the traceback module --
print_exc() and friends. I want to include the module name, class name (if
possible), and function name.
Some background: traceback.print_exc() iterates through traceback object
On Thu, Nov 13, 2014 at 3:48 PM, wrote:
> import sys
> for stream in (sys.stdin, sys.stdout, sys.stderr):
>print(stream.fileno())
>
>
> io.UnsupportedOperation: fileno
>
> Is there a workaround?
> --
> https://mail.python.org/mailman/listinfo/python-list
Works for me, although it's a
On Fri, Nov 14, 2014 at 10:42 AM, Empty Account wrote:
> Hi,
>
> I am thinking about writing a load test tool in Python, so I am interested
> in how I can create the most concurrent threads/processes with the fewest OS
> resources. I would imagine that I/O would need to be non-blocking.
>
> There
On Sun, Nov 16, 2014 at 4:01 PM, Rick Johnson
wrote:
> Creating an "implicit name resolution system" (aka: import)
> to abstract away an "explicit name resolution system"
> (file-paths) has resulted in more problems that it can solve:
>
> 1. Name clashes!
> 2. Smaller name pool!
> 3. M
Python's attempt to solve the "external dependencies problem"
has yet to produce the results that many people, including
myself, would like.
Actually, Python is not alone in this deficiency, no, Python
is just *ANOTHER* language in a *STRING* of languages over
the years who has *YET AGAIN* implem
Igor Korot Wrote in message:
> Hi, ALL,
>
> C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python
> Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
from a.b import c
p
On Sun, Nov 16, 2014 at 3:12 PM, Igor Korot wrote:
> In the https://docs.python.org/2/library/inspect.html, it says it is
> located in Lib/inspect.py.
>
> What am I missing? Or its only for 3.x?
You need to import it. If you're curious, you can find out exactly
where it's imported from like this:
Hi, ALL,
C:\Documents and Settings\Igor.FORDANWORK\Desktop\winpdb>python
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from a.b import c
>>> print c.classA
>>> inspect.getmembers(c.clas
On Sun, Nov 16, 2014 at 12:57 PM, Michael Torrie wrote:
> In my last system administration job, we forbade installing from source,
> at least in the manner you are describing. It's a maintenance
> nightmare. Especially when it comes time to upgrade the system and get
> things up and running on a
On 11/15/2014 06:08 PM, Steven D'Aprano wrote:
> Assuming it was RHEL 6, then installing Python 2.7 from source as a separate
> application from the system Python should be trivially easy, half an hour's
> work. Download the source, untar, run ./configure, make, make altinstall
> and you should be
On Sun, Nov 16, 2014 at 12:08 PM, Steven D'Aprano
wrote:
> Assuming it was RHEL 6, then installing Python 2.7 from source as a separate
> application from the system Python should be trivially easy, half an hour's
> work. Download the source, untar, run ./configure, make, make altinstall
> and you
On Sat, 15 Nov 2014 22:52:33 +, Charles T. Smith wrote:
> Now, I'm getting these errors:
>
> ImportError: cannot import name ...
>
> and
>
> AttributeError: 'module' object has no attribute ...
It would be useful to know what you're actually trying to import and what
the complete erro
Grant Edwards wrote:
> On 2014-11-15, Steven D'Aprano
> wrote:
>> pythonista wrote:
>>
>>> I am developing a python application as a contractor.
>>>
>>> I would like to know if someone can provide me with some insight into
>>> the problems that then infrastructure team has been having.
>>>
>>>
"Charles T. Smith" writes:
> Now, I'm getting these errors:
Please reduce the problem to a minimal, complete example demonstrating
the behaviour http://sscce.org/> so that you can show us exactly
what's happening.
> AttributeError: 'module' object has no attribute ...
>
> (what is 'module'?)
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 11/15/2014 8:24 AM, Marko Rauhamaa wrote:
I'd take top-posting if I were enlightened about how decorators could be
valuable.
Here is part of the original rationale.
@deco(arg)
def f: suite
is (for this discussion) equivalent to
def f: suite
f = deco(arg)(f)
The latter requires writing '
On 11/15/2014 7:28 AM, Steven D'Aprano wrote:
Terry Reedy wrote:
On 11/13/2014 6:11 PM, Rick Johnson wrote:
# The parse functions have no idea what to do with
# Unicode, so replace all Unicode characters with "x".
# This is "safe" so long as the only characters germane
On Sat, Nov 15, 2014 at 10:07 AM, ast wrote:
> Hi
>
> I needed a function f(x) which looks like sinus(2pi.x) but faster.
> I wrote this one:
>
> --
> from math import floor
>
> def sinusLite(x):
>x = x - floor(x)
>return -16*(x-0.25)**2 + 1 if x < 0.5 else 16*(x-0.7
On Sat, 15 Nov 2014 18:07:30 +0100, ast wrote:
>
> I needed a function f(x) which looks like sinus(2pi.x) but faster.
> I wrote this one:
>
> --
> from math import floor
>
> def sinusLite(x):
> x = x - floor(x)
> return -16*(x-0.25)**2 + 1 if x < 0.5 else 16*(x-0.75)
"ast" Wrote in message:
> Hi
>
> I needed a function f(x) which looks like sinus(2pi.x) but faster.
> I wrote this one:
>
> --
> from math import floor
>
> def sinusLite(x):
> x = x - floor(x)
> return -16*(x-0.25)**2 + 1 if x < 0.5 else 16*(x-0.75)**2 - 1
>
ast wrote:
> Hi
>
> I needed a function f(x) which looks like sinus(2pi.x) but faster.
> I wrote this one:
>
> --
> from math import floor
>
> def sinusLite(x):
> x = x - floor(x)
> return -16*(x-0.25)**2 + 1 if x < 0.5 else 16*(x-0.75)**2 - 1
> -
On 11/15/2014 10:13 AM, Michael Torrie wrote:
> If it's a package that won't conflict, such as Python 2.4, you can
Ahem, that should have been 3.4
--
https://mail.python.org/mailman/listinfo/python-list
On 11/14/2014 08:01 PM, pythonista wrote:
> The scope of the project was to install python 2.7.8 and 4 modules/site
> packages on a fresh linux build.
I neglected to put the URL for software collections in my reply to you.
Here it is.
https://www.softwarecollections.org/en/scls/rhscl/python27/
Hi
I needed a function f(x) which looks like sinus(2pi.x) but faster.
I wrote this one:
--
from math import floor
def sinusLite(x):
x = x - floor(x)
return -16*(x-0.25)**2 + 1 if x < 0.5 else 16*(x-0.75)**2 - 1
--
then i used module timeit
On 11/15/2014 08:15 AM, Steven D'Aprano wrote:
> A "fresh linux build" of Red Hat Linux 6? RHL 6 was discontinued in 2000.
Yes I know you're making a point about not assuming anything, but the
odds are very good that the OP meant RHEL6.
And meaning RHEL6, there are some good reasons why the infra
On 11/14/2014 08:01 PM, pythonista wrote:
> Can anyone provide me with insight as to the scope what the problem could
> have been?
Well the fact is that RHEL 6 uses Python 2.6 as a core system package.
Many system utilities depend on it, so it cannot be replaced with a
newer version. You must in
On 2014-11-15, Steven D'Aprano wrote:
> pythonista wrote:
>
>> I am developing a python application as a contractor.
>>
>> I would like to know if someone can provide me with some insight into the
>> problems that then infrastructure team has been having.
>>
>> The scope of the project was to in
Richard Riehle wrote:
> Decorators are new in Python, so there are not a lot of people using them.
The principle of decorators themselves is as old as Python itself. You could
implement them as far back as Python 1.5, if not older:
[steve@ando ~]$ python1.5
Python 1.5.2 (#1, Aug 27 2012, 09:09
On 2014-11-15, Marko Rauhamaa wrote:
> Tim Chase :
>
>> And decorators are used pretty regularly in just about every code-base
>> that I've touched (I've been programming in Python since early 2004,
>> so I've maintained pre-2.4 code without decorators and then brought it
>> forward to 2.4 where d
pythonista wrote:
> I am developing a python application as a contractor.
>
> I would like to know if someone can provide me with some insight into the
> problems that then infrastructure team has been having.
>
> The scope of the project was to install python 2.7.8 and 4 modules/site
> packages
What are the basics of implement web hooks with python?
I need some detail tutorial in this topic.
Thanks
--
https://mail.python.org/mailman/listinfo/python-list
Mark Lawrence :
> On 15/11/2014 07:42, Richard Riehle wrote:
>> When I discovered them, I instantly saw how they could be valuable.
>
> Would you please be kind enough to get a PhD in interspersing your
> replies or bottom posting rather than top posting, thank you.
I'd take top-posting if I were
On 15/11/2014 07:42, Richard Riehle wrote:
Mayank,
Thanks. I have only been using Python for about four years, so there
are features I have only recently discovered. Decorators are one of
them. So far, I encounter other Python users who are also unfamiliar
with them. When I discovered them,
Terry Reedy wrote:
> On 11/13/2014 6:11 PM, Rick Johnson wrote:
>
>> # The parse functions have no idea what to do with
>> # Unicode, so replace all Unicode characters with "x".
>> # This is "safe" so long as the only characters germane
>> # to parsing the structure of Python
Steven D'Aprano :
> if __name__ == '__main__' or condition():
> print "still executing"
> main()
>
> print "done loading"
>
> (I haven't ever done *all* of these things in a *single* file, but I
> have done all these things at one time or another.)
>
> There's no way that any automatic sys
Ian Kelly wrote:
> On Fri, Nov 14, 2014 at 12:36 AM, Cameron Simpson wrote:
>> On 13Nov2014 15:48, satishmlm...@gmail.com
>> wrote:
>>>
>>> import sys
>>> for stream in (sys.stdin, sys.stdout, sys.stderr):
>>> print(stream.fileno())
>>>
>>>
>>> io.UnsupportedOperation: fileno
>>>
>>> I
Chris Kaynor wrote:
> I was thinking along the lines of replacing:
>
> if __name__ == "__main__":
> <<>>
>
> with
>
> @main
> def myFunction()
> <<<>
>
> Both blocks of code will be called at the same time.
You can't guarantee that, because you cannot tell ahead of time when the "if
__name__
John Ladasky wrote:
> I have taught Python to several students over the past few years. As I
> have worked with my students, I find myself bothered by the programming
> idiom that we use to determine whether a module is being executed or
> merely imported:
>
> "if __name__ == '__main__':"
>
>
On 7 November 2014 15:46, Paul Moore wrote:
> To that end, I'd like to get an idea of what sort of access to Windows
> a typical Unix developer would have.
Thanks to all who contributed to this thread.
Based on the feedback, I think it's going to be useful to provide two
options. First of all, a
ast wrote:
> Hello
>
> I saw in a code from a previous message in this forum
> a curious function argument.
>
> def test(x=[0]):
>print(x[0]) ## Poor man's object
>x[0] += 1
>
test()
> 0
test()
> 1
test()
> 2
>
> I understand that the author wants to implement a
46 matches
Mail list logo