some n00b question

2006-08-11 Thread Omar
I'm learning how to program python.  a few questions

a) I'm mostly interested in creating exe's that have to do with music
-- things to help me keep track of chord progressions, transpositions,
etc.  can anyone point me in the direction of resources on this?

b) I'm also interested in created GUI's sooner rather than later.  Can
anyone point me to a fast track to doing GUI's on python?

thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: some n00b question

2006-08-11 Thread Omar

John Salerno wrote:
> Omar wrote:
>
> > b) I'm also interested in created GUI's sooner rather than later.  Can
> > anyone point me to a fast track to doing GUI's on python?
>
> I recommend reading wxPython in Action. It's a great starter and
> reference to the wxPython GUI toolkit. Tkinter is usually considered
> easier and simpler, but I find it lacking in functionality, and wxPython
> is actually fairly easy to learn.

thanks, John

anyone on the music side?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: some n00b question

2006-08-11 Thread Omar

Gerard Flanagan wrote:
> Omar wrote:
> > I'm learning how to program python.  a few questions
> >
> > a) I'm mostly interested in creating exe's that have to do with music
> > -- things to help me keep track of chord progressions, transpositions,
> > etc.  can anyone point me in the direction of resources on this?
> >
> > b) I'm also interested in created GUI's sooner rather than later.  Can
> > anyone point me to a fast track to doing GUI's on python?
> >
> > thanks
>
> Hi Omar
>
> are you aware of lilypond, used for typesetting music? (not what you
> asked about I know!).  'lilycomp' is a simple (tkinter) gui for
> creating lilypond markup, maybe some ideas there.
>
> http://lilypond.org/web/
>
> http://lilycomp.sourceforge.net/
>
> hope that helps.
>
> Gerard

thank you Larry and thank you Gerard!  People on this forum are
apparantly quite cool.

-- 
http://mail.python.org/mailman/listinfo/python-list


More Noob Questions

2006-10-18 Thread Omar
Hi all...this is a good group so I'm sure you'll tolerate some more
noobish questions...

1) I'm also learning to program flash movies while I learn to do
python.  How can one implement flash movies into their python code?

2) besides Chieh's tutorials on the python.org site, anyone know of any
other video tutorials for python?  this style of learning suites me
well.

more to come!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: More Noob Questions

2006-10-27 Thread Omar
thank you all for your replies

-- 
http://mail.python.org/mailman/listinfo/python-list


"Music Theory Programming" Google Group

2006-10-27 Thread Omar
I've been learning some programming during my little sabbatical (mostly
python), and I thought it'd be cool to see if other people are
interested in programming for music theory.  So I started a Music
Theory Programming google group.  Consider yourselves invited!  It'll
be a place for people with different ideas to make music easier to
understand using computer applications to share and collab.

The address is:

http://groups.google.com/group/music-theory-programming

If you know how to do any language (HTML, Perl, Java, C++) etc or just
interested...see ya there!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: More Noob Questions

2006-10-27 Thread Omar

Roberto Bonvallet wrote:
> Omar wrote:
> > more to come!
>
> Please, use a more meaningful subject next time, like "Integration of
> Python and Flash" or "Where can I find vido tutorials".  That way it will
> be easier to people that knows about the subject to find your message and
> answer you.
>
> And please think of us, non-native English speakers, that don't know slang
> words like "noob" that don't even appear in the dictionaries and don't add
> anything to your question.
> 
> Cheers,
> -- 
> Roberto Bonvallet

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Music Theory Programming" Google Group

2006-10-27 Thread Omar
see you over there!

-- 
http://mail.python.org/mailman/listinfo/python-list


Programming Language that is Spreadsheet/Table Based

2006-11-03 Thread Omar
I'm looking for a programming language or module that sorta looks and
feels like MS Excel (I love and think in tables), yet has the power and
open-endedness of python or javascript.  I'm still pretty new to
python.

any ideas?  i've been having some fun with VBA in excel, but I want
something I can save as en exe and call my own creation, y'know?

-- 
http://mail.python.org/mailman/listinfo/python-list


Script Bug?

2006-09-06 Thread Omar
okay,I'm going through this python tutorial, and according to the
tutorial, I can type this:

[code]
myList = [1,2,3,4]
for index in range(len(myList)):
myList[index] += 1
print myList
[/code]

however, in my IDLE python shell, when I type

[code]
>>> myList = [1,2,3,4]
>>> for index in range(len(myList)):[/code]

it just gives me a prompt
[code]
>>> [/code]

?

why doesn't it just bring me to line three?  I need to have
persistence, cause little snags like these discourage me.  I know I
need thicker skin to write code.

any advice is appreciated

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Script Bug?

2006-09-06 Thread Omar
no, i put those there.

i have restarted IDLE and it now works.  a friend told me it was a bug
in IDLE.

I'd like to try activepython, but i can't dl it from work (that site is
blocked for some reason).  anybody got the install for it, or a mirror
location for it?

-- 
http://mail.python.org/mailman/listinfo/python-list


3 Simple Questions About Python/IDLE

2006-09-07 Thread Omar
1) why don't python / idle use numbered lines in their scripting, like
basic?  how do you keep track of large batches of code without them?

2) in IDLE, how do you save a program such that it can be run, say from
windows the "run" function?

3) are most of you doing your script editing in IDLE or something more
fully featured?

4) how are you importing previously written blocks of code into your
code?  cut and paste?  what is the best way to organize snippets of
code?

thanks, peeps

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 3 Simple Questions About Python/IDLE

2006-09-07 Thread Omar
thanks

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 4 Simple Questions About Python/IDLE

2006-09-07 Thread Omar
thanks.

i have saved and double clicked as suggested.  when I save and double
click a simple "hello program", the b&w python shell briefly comes up,
then disappears. is this how it should work?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 4 Simple Questions About Python/IDLE

2006-09-07 Thread Omar
thank you genteman.

however, its not working :(

I resaved it, but same thing.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 4 Simple Questions About Python/IDLE

2006-09-07 Thread Omar
sure...

>>> print "hello world"
hello world
>>> t=raw_input('Hit return to continue')

I'm saving it as "helloworld11", then double clicking the icon I saved
it as.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 4 Simple Questions About Python/IDLE

2006-09-07 Thread Omar
okay...

I got to work using the SCITE editor with

print "hello world" # here we are once again
raw_input("press return") 

cool!

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 4 Simple Questions About Python/IDLE

2006-09-07 Thread Omar
I'm working through a tutorial,
http://swaroopch.info/text/Byte_of_Python:Control_Flow, and I sorta
can't get through the tutorial without overcoming these little
speedbumps.  This is why I'm asking these questions.

-- 
http://mail.python.org/mailman/listinfo/python-list


Looking for the Perfect Editor

2006-09-07 Thread Omar
I'd love the perfect editor that would be:

a) free

b) enable me to drag and drop code snippets from a sort of browser into
the code

c) can run programs right from within

d) can edit
  - PYTHON
  - Javascript
  - HTML
  - actionscript (since I'm also learning flash)

e) easy to learn

suggestions?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for the Perfect Editor

2006-09-08 Thread Omar
thanks for the suggestions, fellas

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for the Perfect Editor

2006-09-08 Thread Omar
thanks for the suggestions, fellas

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for the Perfect Editor

2006-09-09 Thread Omar
I've been using scite the last few days, and have also been
experimenting with ulipad.

thanks, again

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for the Perfect Editor

2006-09-12 Thread Omar
thanks for all the responses...

I'm liking the way ulipad and scite work

I'd switch to ulipad entirely if I canget to recognize the python
interpreter in the preferences menu.  I can't seem to figure that out.

Also, I'm highly interested in getting the snippets manager working.

any ideas?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for the Perfect Editor

2006-09-13 Thread Omar
thank you claudio for your comprehensive answer.  I will work on it.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: EuroPython 2016 Keynote: Paul Hildebrandt

2016-06-02 Thread Omar Abou Mrad
Quick note: blog and conference schedule links in the
europython.eu site's custom 404 page are incorrect.

https://ep2016.europython.eu/en/foobarbaz/

On Tue, May 31, 2016 at 4:22 PM, M.-A. Lemburg  wrote:

> We are pleased to announce our next keynote speaker for EuroPython
> 2016:
>
>
>*** Paul Hildebrandt ***
>
>
>
> About Paul Hildebrandt
> --
>
> Paul Hildebrandt has been a Senior Engineer with Walt Disney Animation
> Studios (WDAS) since 1996, and has worked in both Systems and Software
> engineering. His current title is Senior Software Engineer and Product
> Owner for the Playback tools among his primary duties is spending time
> working with the artists, understanding their needs, and designing
> tools to assist them. If he is lucky, he gets to write code.
>
> Hildebrandt was born and raised in Anaheim, California. He received
> his BSEE with a focus on Computing from California Polytechnic
> University Pomona. He resides outside of Los Angeles with his wife and
> three boys.
>
> The Keynote: Inside the Hat: Python @ Walt Disney Animation Studios
> ---
>
> The Walt Disney Animation Studios has a long history of creating
> acclaimed animated films and continues to be an industry leader with
> regards to artistic achievements, storytelling excellence, and
> cutting-edge innovations. Since the 1923 release of “Snow White”
> they’ve been pushing forward technology in the art of movie
> making. This push continues in the modern day with classics such as
> Oscar winning box office hits “Big Hero 6” and “Frozen” and Oscar
> nominated hits “Wreck-It Ralph”, “Tangled”, “Bolt”, “Treasure Planet”,
> and “Dinosaur”.
>
> One of the most common questions I get when attending Python
> conferences is “Why are you here?”  People seem confused that
> technology, especially Python is used in the making of animated
> films.
>
> Paul will give you some background on the Walt Disney Animation
> Studios and talk about where specifically Python comes into play.
>
>
> With gravitational regards,
> --
> EuroPython 2016 Team
> http://ep2016.europython.eu/
> http://www.europython-society.org/
>
>
> PS: Please forward or retweet to help us reach all interested parties:
> https://twitter.com/europython/status/737633789116088320
> Thanks.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Please solve this problem

2020-03-09 Thread Omar Abou Mrad
On Mon, Mar 9, 2020 at 11:21 AM sachin thakur 
wrote:

> Rply if solved
>
> <..snip..>


Solved, answer is:
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pylint 1.5.0 / Astroid 1.4.1 released

2015-12-01 Thread Omar Abou Mrad
On Tue, Dec 1, 2015 at 1:42 AM, Claudiu Popa  wrote:

> Hello,
>
>
> I'm happy to announce you the release of Pylint 1.5.0,
> respectively Astroid 1.4.1.
>
> 
>
> Claudiu
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Awesome! Congrats!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bash-like pipes in Python

2016-03-19 Thread Omar Abou Mrad
On Wed, Mar 16, 2016 at 5:39 PM, Steven D'Aprano 
wrote:

> On Thu, 17 Mar 2016 02:22 am, Omar Abou Mrad wrote:
>
> > Would be nice if this was possible:
> >
> >>>> get_digits = Filter(str.isdigit) | Map(int)
> >>>> 'kjkjsdf399834' | get_digits
>
>
> Yes it would. I'll work on that.
>
>
> > Also, how about using '>>' instead of '|' for "Forward chaining"
>
> Any particular reason you prefer >> over | as the operator?


Nothing major, only that it's closer to visual "forward" a la F#'s |>
operator.
I tend to see | as an indication of "OR" (bit or otherwise) rather than pipe
(which I completely understand why you picked it).

On a somewhat related note I had experimented with an overridden '|'
a while ago to lift conditions and compose them (which is what spurred
the get_digits question).

https://gist.github.com/omaraboumrad/8424298
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Bash-like pipes in Python

2016-03-19 Thread Omar Abou Mrad
On Wed, Mar 16, 2016 at 4:57 PM, Steven D'Aprano 
wrote:

> There's a powerful technique used in shell-scripting languages like bash:
> pipes. The output of one function is piped in to become the input to the
> next function.
>
> According to Martin Fowler, this was also used extensively in Smalltalk:
>
> http://martinfowler.com/articles/collection-pipeline/
>
> and can also be done in Ruby, using method chaining.
>
> Here is a way to do functional-programming-like pipelines to collect and
> transform values from an iterable:
>
> https://code.activestate.com/recipes/580625-collection-pipeline-in-python/
>
> For instance, we can take a string, extract all the digits, convert them to
> ints, and finally multiply the digits to give a final result:
>
> py> from operator import mul
> py> "abcd12345xyz" | Filter(str.isdigit) | Map(int) | Reduce(mul)
> 120
>
> <..snip..>
>

Would be nice if this was possible:

>>> get_digits = Filter(str.isdigit) | Map(int)
>>> 'kjkjsdf399834' | get_digits

Also, how about using '>>' instead of '|' for "Forward chaining"

Regards,

Omar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Show off your Python chops and compete with others

2013-11-07 Thread Omar Abou Mrad
On Thu, Nov 7, 2013 at 2:00 AM, Nathaniel Sokoll-Ward <
nathanielsokollw...@gmail.com> wrote:

> Thought this group would appreciate this:
> www.metabright.com/challenges/python
>
> MetaBright makes skill assessments to measure how talented people are at
> different skills. And recruiters use MetaBright to find outrageously
> skilled job candidates.
>
> Python is a new area of expertise for us. We make "Challenges" for a bunch
> of languages and we're excited to finally have Python released. Give it a
> shot -- I'd love to hear what you think.
> --
> https://mail.python.org/mailman/listinfo/python-list


Nathaniel,

You may want to classify the questions under some weight. You can't really
have a level 6 question about semi colon.

Also, when the boss questions are being computed, you should run more than
the 'example' given as a test, otherwise users can just cheat. For example,
I think one of the 'Boss' question was return the first 3 digits of PI as a
list, all i did was:

return [3,1,4]

Hope this helps.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-09 Thread Omar Abou Mrad
On Thu, Mar 5, 2015 at 3:34 AM, Xrrific  wrote:

> Guys, please Help!!!
>
> I am trying to impress a girl who is learning python and want ask her out
> at the same time.
>
> Could you please come up with something witty incorporating a simple
> python line like If...then... but..etc.
>
> You will make me a very happy man!!!
>
> Thank you very much!!!
> --
> https://mail.python.org/mailman/listinfo/python-list
>

>>> print "Svar lbh jva! V'yy cvpx lbh hc gbzbeebj ng 7 :)".decode('rot13')
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Where is 'palindrome' defined?

2015-06-01 Thread Omar Abou Mrad
On Mon, Jun 1, 2015 at 7:46 AM, fl  wrote:

> Hi,
>
> When I search solution of reverse a string/number, I came across a short
> function online:
>
> >>> def palindrome(num):
> return str(num) == str(num)[::-1]
>
> I thought that it is a general function. And with the following variable:
>
> >>> a
> '1234_'
>
> >>> parlindrome(a)
>
> Traceback (most recent call last):
>   File "", line 1, in 
> parlindrome(a)
> NameError: name 'parlindrome' is not defined
>
> 


Further to the mentioned, be careful with your spelling, the function name
as you've shown is "palindrome" but you're invoking it using "parlindrome".

Regards
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Twitter Client on Terminal by Python

2014-07-14 Thread Omar Abou Mrad
Dear Orakaro,

Cool app you have there. Please consider the following comments as feedback
in the most positive sense possible:

- I didn't care for the figlet, it's noise beyond anything else, if you
drop it, you would drop the pyfiglet dependency as well
- What's with the SQLAlchemy dependency? I checked your table definitions
and if I'm not mistaken all you're using is Theme, Message, Tweet. My first
question on that front is why are message and tweet stored locally? Are you
doing local caching to speed things up? What about theme?

Good job and take care!

Regards,

Omar


On Sun, Jul 13, 2014 at 9:00 PM, Orakaro  wrote:

> Hello!
>
> I'm @dtvd88 on Twitter and very new here.
> I read from python.org that anything Python-related can be discussed, and
> not sure if I can share my OSS package here to get feedback or not ?
>
> I just wrote a Twitter Client on Terminal by Python, it has very beautiful
> display and even can display image on terminal. Check it out and maybe you
> guys will love it :)
>
> Homepage: http://www.rainbowstream.org/
> Github: https://github.com/DTVD/rainbowstream
>
> Thanks for any feedback and sorry if this kind of topics is not tolerated
> here.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: class attribute confusion

2010-12-04 Thread Omar Abo-Namous

Am 03.12.2010 23:11, schrieb Arnaud Delobelle:

OAN  writes:


Hi,

i was having a problem with class attributes initiated outside of
__init__. This code is a demonstration of what i mean:

class A():
 mylist = []
 def __init__(self):
 self.mylist.append(1)
 pass

class B(A):
 def __init__(self):
 A.__init__(self)
 self.mylist.append(2)

v = A()
print 'v:',v.mylist
x = B()
print 'x:',x.mylist
y = B()
print 'y:',y.mylist
z = A()
print 'z:',z.mylist
print 'v:',v.mylist

I would expect the following result:

v: [1]
x: [1, 2]
y: [1, 2]
z: [1]
v: [1]

Who wouldn't, right? But actually python 2.6(.6) gives me the
following result:

v: [1]
x: [1, 1, 2]
y: [1, 1, 2, 1, 2]
z: [1, 1, 2, 1, 2, 1]
v: [1, 1, 2, 1, 2, 1]

The four variables v,x,y and z now actually share the same 'mylist'!!
To get the correct results, i have to initialize 'mylist' inside of
the __init__ method!

Yes.  See below.


I think this behaviour is totally wrong, since it seems
A.__init__(self) is changing the value inside of A() not inside of the
object variable 'self' (that should be x or y)!!

It's not wrong at all.  You expect "mylist" to behave as an instance
attribute, but you defined it as a class attribute.  Instance attributes
are naturally initialised in the __init__() method.


Could you please point me to a reference in the doc??

Thanks in advance.


--
http://mail.python.org/mailman/listinfo/python-list


Re: Case Solution: A Dark Horse in the Global Smartphone Market Huawei's Smartphone Strategy by Yangao Xiao, Tony Tong, Guoli Chen, Kathy Wu

2017-08-31 Thread ahmed . gamal . omar . 80
On Saturday, 8 July 2017 05:22:24 UTC+2, Case Solution & Analysis  wrote:
> Case Solution and Analysis of A Dark Horse in the Global Smartphone Market: 
> Huawei's Smartphone Strategy by Yangao Xiao, Tony Tong, Guoli Chen, Kathy Wu 
> is available at a lowest price, send email to 
> casesolutionscentre(at)gmail(dot)com 
> 
> Case Study ID: IN1324
> 
> Get Case Study Solution and Analysis of A Dark Horse in the Global Smartphone 
> Market: Huawei's Smartphone Strategy in a FAIR PRICE!! 
> 
> Our e-mail address is CASESOLUTIONSCENTRE (AT) GMAIL (DOT) COM. Please 
> replace (at) by @ and (dot) by . 
> 
> YOU MUST WRITE FOLLOWING WHILE PLACING YOUR ORDER: 
> Complete Case Study Name 
> Authors 
> Case Study ID 
> Publisher of Case Study 
> Your Requirements / Case Questions 
> 
> Note: Do not REPLY to this post because we do not reply to posts here. If you 
> need any Case Solution please send us an email. We can help you to get it.

-- 
https://mail.python.org/mailman/listinfo/python-list


I can not install matplotlib, numpy, scipy, and pandas.

2016-01-06 Thread Omar Ray via Python-list
I have version 3.5 of Python for Windows.  I have MS Visual C++ and also MS
Visual Studio 2015.

When I enter into the command window "pip install matplotlib", it reads this
below (this is not the full version of it): 

 

Microsoft Windows [Version 6.1.7601]

Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

 

C:\windows\system32>pip install matplotlib

Collecting matplotlib

  Using cached matplotlib-1.5.0-cp35-none-win32.whl

Requirement already satisfied (use --upgrade to upgrade): pytz in
c:\users\---\a

ppdata\local\programs\python\python35-32\lib\site-packages (from matplotlib)

Requirement already satisfied (use --upgrade to upgrade):
pyparsing!=2.0.4,>=1.5

.6 in
c:\users\---\appdata\local\programs\python\python35-32\lib\site-packages (

from matplotlib)

Requirement already satisfied (use --upgrade to upgrade): python-dateutil in
c:\

users\---\appdata\local\programs\python\python35-32\lib\site-packages (from
matp

lotlib)

Requirement already satisfied (use --upgrade to upgrade): cycler in
c:\users\---

\appdata\local\programs\python\python35-32\lib\site-packages (from
matplotlib)

Collecting numpy>=1.6 (from matplotlib)

  Using cached numpy-1.10.2.tar.gz

Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in
c:\users\-

--\appdata\local\programs\python\python35-32\lib\site-packages (from
python-date

util->matplotlib)

Installing collected packages: numpy, matplotlib

  Running setup.py install for numpy

Complete output from command
c:\users\---\appdata\local\programs\python\pyth

on35-32\python.exe -c "import setuptools,
tokenize;__file__='C:\\Users\\---\\App

Data\\Local\\Temp\\pip-build-yrpyslwq\\numpy\\setup.py';exec(compile(getattr
(tok

enize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
'exec'))"

install --record
C:\Users\---\AppData\Local\Temp\pip-o2xr7r52-record\install-re

cord.txt --single-version-externally-managed --compile:

blas_opt_info:

blas_mkl_info:

  libraries mkl,vml,guide not found in
['c:\\users\\---\\appdata\\local\\pro

grams\\python\\python35-32\\lib', 'C:\\',
'c:\\users\\---\\appdata\\local\\progr

ams\\python\\python35-32\\libs']

  NOT AVAILABLE

 

How do I download matplotlib and the other packages mentioned in the subject
line?

 

-Omar Ray

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PEP Idea: Extended import syntax for aliasing module attributes

2025-06-18 Thread Omar Ahmed via Python-list
The solution was provided in this thread here:
https://discuss.python.org/t/extended-import-syntax-for-aliasing-module-attributes/95920/3
The correct way to implement is:
import module
from module import optimize, validate as check
-- 
https://mail.python.org/mailman3//lists/python-list.python.org


Re: PEP Idea: Extended import syntax for aliasing module attributes

2025-06-18 Thread Omar Ahmed via Python-list
Thank you. I have posted this idea on https://discuss.python.org/c/ideas/6
I had difficulty trying to find that.
-- 
https://mail.python.org/mailman3//lists/python-list.python.org


Re: PEP Idea: Extended import syntax for aliasing module attributes

2025-06-18 Thread Omar Ahmed via Python-list
Thank you. I have used this link. I had difficulty finding it.
https://discuss.python.org/
-- 
https://mail.python.org/mailman3//lists/python-list.python.org


PEP Idea: Extended import syntax for aliasing module attributes

2025-06-16 Thread Omar Ahmed via Python-list
Hi all,
I would like to propose a potential addition to Python's `import` syntax that 
would improve clarity and ergonomics for cases where developers want both full 
module access *and* a local alias to a specific attribute within that module.

Currently, to get both behaviors, we typically write:
import module
optimize = module.optimize

This works fine, but it is slightly verbose and less explicit in intent.

I would like to explore syntax like:
import module with module.optimize as optimize
or possibly:
import module with (
module.optimize as optimize,
module.validate as check
)

The goal is to import the full module as usual, while simultaneously assigning 
a local name to a chosen sub-attribute all in a single declaration.

This strikes a balance between:
*Readability* (makes intensions clearer)
*Convenience* (avoids repetitive alias assignments)
*Maintainability* (discourages `from module import *`)

I am curious to hear whether this type of syntax has been considered before, or 
if it might be worth formalizing into a PEP. I would be happy to help develop a 
draft proposal if there is interest.

Thank you for reading.
-Omar
-- 
https://mail.python.org/mailman3//lists/python-list.python.org